Reputation: 93
Is it possible to repurpose existing code connecting to ActiveMQ "Classic" to connect to ActiveMQ Artemis by changes to configuration? If so what are the important parameters that need to be modified?
Current software is deployed on JBoss EAP 7.4.2 and communicates with 2 remote ActiveMQ "Classic" servers that provide support for failover/ha.
In the new architecture the ActiveMQ "Classic" servers will get replaced by 3 independent ActiveMQ Artemis servers (version 2.16.0) which will provide failover/HA. Support for embedded ActiveMQ Artemis in JBoss EAP will not be utilized.
ActiveMQ resource adapter settings:
<subsystem xmlns="urn:jboss:domain:resource-adapters:6.0">
<resource-adapters>
<resource-adapter id="org.apache.activemq">
<module slot="main" id="org.apache.activemq"/>
<config-property name="RedeliveryBackOffMultiplier">3</config-property>
<config-property name="ServerUrl">failover:(tcp://x.y.z.49:61616,tcp://x.y.z.50:61616)?randomize=false&jms.watchTopicAdvisories=false&timeout=3000</config-property>
<config-property name="RedeliveryUseExponentialBackOff">false</config-property>
<config-property name="UserName">user</config-property>
<config-property name="MaximumRedeliveries">1</config-property>
<config-property name="UseInboundSession">true</config-property>
<config-property name="Password">password</config-property>
<connection-definitions>
<connection-definition class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory" jndi-name="java:/ConnectionFactory" enabled="true" tracking="false" use-java-context="true" pool-name="ConnectionFactory">
<config-property name="UseInboundSession">false</config-property>
<pool>
<min-pool-size>4</min-pool-size>
<max-pool-size>256</max-pool-size>
<prefill>true</prefill>
</pool>
<timeout>
<blocking-timeout-millis>12000</blocking-timeout-millis>
<idle-timeout-minutes>5</idle-timeout-minutes>
</timeout>
</connection-definition>
</connection-definitions>
JNDI is used to lookup the connection factory, using InitialContext
as shown in the following code
import javax.inject.Inject;
import javax.jms.ConnectionFactory;
import javax.naming.InitialContext;
import javax.ejb.Singleton;
import javax.ejb.Startup;
@Singleton
@Startup
public class BootClass {
....
@PostConstruct
public void init() {
try {
// "java/ConnectionFactory" defined in resource adapter
final ConnectionFactory cf = (ConnectionFactory) (new InitialContext()).lookup("java:/ConnectionFactory");
// cf is used with Camel JMS component
Upvotes: 0
Views: 253
Reputation: 35122
Technically speaking you don't actually need to change anything in JBoss EAP because ActiveMQ Artemis supports the OpenWire protocol which is used by ActiveMQ "Classic".
Upvotes: 0