Skip to content

Instantly share code, notes, and snippets.

@leosilvadev
Last active May 7, 2024 18:38
Show Gist options
  • Save leosilvadev/cdb54d89555fbabbd3b2102ddb097514 to your computer and use it in GitHub Desktop.
Save leosilvadev/cdb54d89555fbabbd3b2102ddb097514 to your computer and use it in GitHub Desktop.
package com.github.leosilvadev.detectorapp;
import jakarta.jms.*;
import org.apache.activemq.artemis.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy;
import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory;
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
import org.springframework.aot.hint.MemberCategory;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.aot.hint.TypeReference;
import org.springframework.jms.connection.SessionProxy;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Date;
import java.util.stream.Stream;
public class SpringArtemisJmsRuntimeHints implements RuntimeHintsRegistrar {
@Override
public void registerHints(final RuntimeHints hints, final ClassLoader classLoader) {
Stream.of(
ActiveMQConnectionFactory.class,
NettyConnectorFactory.class,
RoundRobinConnectionLoadBalancingPolicy.class,
Date[].class,
java.sql.Date[].class,
Calendar[].class,
Time[].class,
Timestamp[].class
).forEach(clazz -> hints.reflection().registerType(clazz, MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS));
hints.reflection().registerType(
TypeReference.of("org.apache.activemq.artemis.core.client.ActiveMQClientMessageBundle_impl"),
MemberCategory.INVOKE_PUBLIC_CONSTRUCTORS
);
hints.proxies().registerJdkProxy(Connection.class, QueueConnection.class, TopicConnection.class);
hints.proxies().registerJdkProxy(SessionProxy.class, QueueSession.class, TopicSession.class);
hints.resources().registerPattern("activemq-version.properties");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment