SocketException Broken pipe receives when the server is under load (Spring AMQP) - spring

We are using Spring AMQP 2.8 with RabbitMQ 2.8.7 version. We are building our connection factory as below.
<!-- RabbitMQ Local connectivity -->
<rabbit:connection-factory
id="localWhispirConnectionFactory"
addresses="${system.local.rabbitmq.host}"
username="${system.local.rabbitmq.username}"
password="${system.local.rabbitmq.password}"
connection-factory="rabbitWhispirLocalFactory"/>
<!-- Heartbeat configuration every 10sec -->
<bean id="rabbitWhispirLocalFactory" class="com.rabbitmq.client.ConnectionFactory">
<property name="requestedHeartbeat" value="10" />
</bean>
But when the server is under load, we received the below exceptions. Tries several ways, but appreciate any comments to overcome this issue.
2015-04-20 12:01:00,174 INFO [SimpleMessageListenerContainer] Restarting Consumer: tag=[amq.ctag-wfazQuIuS-BM-CosxP_2GJ], channel=Cached Rabbit Channel: AMQChannel(amqp://whispir#10.50.50.128:5672/,62), acknowledgeMode=AUTO local queue size=0
2015-04-20 12:01:00,156 WARN [SimpleMessageListenerContainer] Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: java.net.SocketException: Broken pipe
2015-04-20 12:01:00,174 INFO [SimpleMessageListenerContainer] Restarting Consumer: tag=[amq.ctag-AjjxOJ2doe4yi2GtTHKumM], channel=Cached Rabbit Channel: AMQChannel(amqp://whispir#10.50.50.128:5672/,29), acknowledgeMode=AUTO local queue size=0
Thanks.

There is no such version (2.8) of Spring AMQP. Currently, the latest version is 1.4.4.
Check the server logs to see if there are any clues there.
That said, 2.8.7 is a very old broker; I am quite sure the rabbitmq guys would recommend upgrading to a more recent version, currently the latest is 3.5.1.

Related

javax.naming.NameNotFoundException for migrating from IBM Mq to tomcat

I am receiving below exception while trying to connect JMS MQ using tomcat. We are migrating from WebSphere to Tomcat.So currently I am using IBM MQ jars
2018-11-21 12:26:53,862 DEBUG com.mbfs.slr.bo.pe.JMSClient.sendMsg:283 - Exception occured : null
2018-11-21 12:26:53,863 DEBUG com.mbfs.slr.bo.pe.JMSClient.receiveMessage:384 - Trying to receive message ...
2018-11-21 12:26:53,863 DEBUG com.mbfs.slr.bo.pe.JMSClient.receiveMessage:385 - getJndiConnectionFactory : jms/Name of Queue
2018-11-21 12:26:53,863 DEBUG com.mbfs.slr.bo.pe.JMSClient.receiveMessage:386 - getRecieveJndiQueueName : jms/name of receiving queue
2018-11-21 12:26:53,864 DEBUG com.mbfs.slr.bo.pe.JMSClient.createQueue:221 - Created JNDI intial Context ...
2018-11-21 12:26:53,864 DEBUG com.mbfs.slr.bo.pe.JMSClient.createQueue:239 - JNDI API lookup failed: javax.naming.NameNotFoundException: Name [jms/NAmeofQueue] is not bound in this Context. Unable to find [jms].
I have placed all IBM MQ jars.I have placed entry in TomEE server.xml and web.xml.
Please let me know if I am missing any configuration
I have placed following entry in
Server.xml
<Resource name="jms/XXXBQueueConnectionFactory" auth="Container" type="com.ibm.mq.jms.MQQueueConnectionFactory" factory="com.ibm.mq.jms.MQQueueConnectionFactoryFactory" description="JMS Queue Connection Factory" HOST="XXXX" PORT="XX5" CHAN="XXX" TRAN="1" QMGR="XXX" />

ActiveMQ Artemis STOMP acceptor not accepting

This is my blueprint code.
Internal activemq:queue:x messages work.
External stomp:queue:y messages don't.
<bean id="artemisConnectionFactory"
class="org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory">
<argument value="${activeMq.Uri}" />
<argument value="${activeMq.userName}" />
<argument value="${activeMq.password}" />
</bean>
<bean id="activemq" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory" ref="artemisConnectionFactory" />
</bean>
<bean id="stomp" class="org.apache.camel.component.stomp.StompComponent">
<property name="brokerURL" value="${activeMq.Uri}" />
<property name="login" value="${activeMq.userName}" />
<property name="passcode" value="${activeMq.password}" />
</bean>
I am running Red Hat AMQ 7 and Fuse 7 inside a docker. The internal message queues work fine between services.
With AMQ 6 I was able to send and receive STOMP messages to an embedded broker on 61613 when set up in the activemq.xml
Now I am using the default setup for AMQ 7.0, which has acceptors set up for 0.0.0.0:61616 and 61613, both accepting STOMP protocol.
But the same client code no longer reaches AMQ 7. I'm using the ports exposed and mapped by Docker.
I use this code for the client.
https://github.com/apache/activemq/tree/master/assembly/src/release/examples/stomp/java
Likewise, I could connect as a consumer with AMQ 6 but no longer with AMQ 7.
Any idea?
Edit: Adding info for Justin:
19:10:41.325 INFO [Blueprint Event Dispatcher: 1] Attempting to start CamelContext: ProxyService
19:10:41.326 INFO [Blueprint Event Dispatcher: 1] Apache Camel 2.21.0.fuse-000077-redhat-1 (CamelContext: ProxyService) is starting
19:10:41.326 INFO [Blueprint Event Dispatcher: 1] JMX is enabled
19:10:41.415 INFO [Blueprint Event Dispatcher: 1] StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html
19:10:41.682 INFO [Blueprint Event Dispatcher: 1] Route: proxyqueue started and consuming from: activemq://queue:registration?password=xxxxxx&username=admin
19:10:41.683 INFO [Blueprint Event Dispatcher: 1] Route: proxyreplyqueue started and consuming from: stomp://queue:reply?login=admin&passcode=xxxxxx
19:10:41.683 INFO [Blueprint Event Dispatcher: 1] Total 2 routes, of which 2 are started
19:10:41.683 INFO [Blueprint Event Dispatcher: 1] Apache Camel 2.21.0.fuse-000077-redhat-1 (CamelContext: ProxyService) started in 0.358 seconds
Artemis logs
2018-11-28 17:38:24,066 INFO [org.apache.activemq.artemis.integration.bootstrap] AMQ101000: Starting ActiveMQ Artemis Server
2018-11-28 17:38:24,286 INFO [org.apache.activemq.artemis.core.server] AMQ221000: live Message Broker is starting with configuration Broker Configuration (clustered=false,journalDirectory=data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/large-messages,pagingDirectory=data/paging)
2018-11-28 17:38:24,504 INFO [org.apache.activemq.artemis.core.server] AMQ221013: Using NIO Journal
2018-11-28 17:38:24,628 INFO [org.apache.activemq.artemis.core.server] AMQ221057: Global Max Size is being adjusted to 1/2 of the JVM max size (-Xmx). being defined as 1,073,741,824
2018-11-28 17:38:24,687 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-server]. Adding protocol support for: CORE
2018-11-28 17:38:24,699 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-amqp-protocol]. Adding protocol support for: AMQP
2018-11-28 17:38:24,700 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-hornetq-protocol]. Adding protocol support for: HORNETQ
2018-11-28 17:38:24,700 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-mqtt-protocol]. Adding protocol support for: MQTT
2018-11-28 17:38:24,700 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-openwire-protocol]. Adding protocol support for: OPENWIRE
2018-11-28 17:38:24,701 INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-stomp-protocol]. Adding protocol support for: STOMP
2018-11-28 17:38:24,952 INFO [org.apache.activemq.artemis.core.server] AMQ221034: Waiting indefinitely to obtain live lock
2018-11-28 17:38:24,952 INFO [org.apache.activemq.artemis.core.server] AMQ221035: Live Server Obtained live lock
2018-11-28 17:38:25,335 INFO [org.apache.activemq.artemis.core.server] AMQ221003: Deploying queue DLQ on address DLQ
2018-11-28 17:38:25,511 INFO [org.apache.activemq.artemis.core.server] AMQ221003: Deploying queue ExpiryQueue on address ExpiryQueue
2018-11-28 17:38:26,119 INFO [org.apache.activemq.artemis.core.server] AMQ221020: Started EPOLL Acceptor at 0.0.0.0:61616 for protocols [CORE,MQTT,AMQP,STOMP,HORNETQ,OPENWIRE]
2018-11-28 17:38:26,171 INFO [org.apache.activemq.artemis.core.server] AMQ221020: Started EPOLL Acceptor at 0.0.0.0:5445 for protocols [HORNETQ,STOMP]
2018-11-28 17:38:26,231 INFO [org.apache.activemq.artemis.core.server] AMQ221020: Started EPOLL Acceptor at 0.0.0.0:5672 for protocols [AMQP]
2018-11-28 17:38:26,243 INFO [org.apache.activemq.artemis.core.server] AMQ221020: Started EPOLL Acceptor at 0.0.0.0:1883 for protocols [MQTT]
2018-11-28 17:38:26,250 INFO [org.apache.activemq.artemis.core.server] AMQ221020: Started EPOLL Acceptor at 0.0.0.0:61613 for protocols [STOMP]
2018-11-28 17:38:26,255 INFO [org.apache.activemq.artemis.core.server] AMQ221007: Server is now live
2018-11-28 17:38:26,255 INFO [org.apache.activemq.artemis.core.server] AMQ221001: Apache ActiveMQ Artemis Message Broker version 2.6.1.amq-720004-redhat-1 [0.0.0.0, nodeID=a46b729a-f323-11e8-9efc-0242ac120003]
2018-11-28 17:38:26,861 INFO [io.hawt.branding.plugin.PluginContextListener] Initialized hawtio-redhat-fuse-branding plugin
2018-11-28 17:38:26,978 INFO [org.apache.activemq.hawtio.plugin.PluginContextListener] Initialized artemis-plugin plugin
2018-11-28 17:38:27,066 INFO [org.apache.qpid.dispatch.PluginContextListener] Initialized dispatch-hawtio-console plugin
2018-11-28 17:38:27,915 INFO [io.hawt.system.ConfigManager] Configuration will be discovered via system properties
2018-11-28 17:38:27,918 INFO [io.hawt.jmx.JmxTreeWatcher] Welcome to hawtio 1.4.0.redhat-630329 : http://hawt.io/ : Don't cha wish your console was hawt like me? ;-)
2018-11-28 17:38:27,925 INFO [io.hawt.jmx.UploadManager] Using file upload directory: /opt/amq/broker/tmp/uploads
2018-11-28 17:38:27,980 INFO [io.hawt.web.AuthenticationFilter] Starting hawtio authentication filter, JAAS realm: "activemq" authorized role(s): "amq" role principal classes: "org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal"
2018-11-28 17:38:28,068 INFO [io.hawt.web.JolokiaConfiguredAgentServlet] Jolokia overridden property: [key=policyLocation, value=file:/opt/amq/broker/etc/jolokia-access.xml]
2018-11-28 17:38:28,093 INFO [io.hawt.web.RBACMBeanInvoker] Using MBean [hawtio:type=security,area=jmx,rank=0,name=HawtioDummyJMXSecurity] for role based access control
2018-11-28 17:38:28,289 INFO [io.hawt.system.ProxyWhitelist] Initial proxy whitelist: [localhost, 127.0.0.1, 172.18.0.3, 9f81c3ea25d9]
2018-11-28 17:38:28,989 INFO [org.apache.activemq.artemis] AMQ241001: HTTP Server started at http://localhost:8161
2018-11-28 17:38:28,989 INFO [org.apache.activemq.artemis] AMQ241002: Artemis Jolokia REST API available at http://localhost:8161/console/jolokia
2018-11-28 17:38:28,989 INFO [org.apache.activemq.artemis] AMQ241004: Artemis Console available at http://localhost:8161/console
2018-11-28 17:45:54,038 WARN [org.apache.activemq.artemis.core.server] AMQ222067: Connection failure has been detected: AMQ119014: Did not receive data from /127.0.0.1:51052 within the 60,000ms connection TTL. The connection will now be closed. [code=CONNECTION_TIMEDOUT]
2018-11-28 17:45:54,039 WARN [org.apache.activemq.artemis.core.server] AMQ222061: Client connection failed, clearing up resources for session 8bc75a6c-f324-11e8-9efc-0242ac120003
2018-11-28 17:45:54,039 WARN [org.apache.activemq.artemis.core.server] AMQ222107: Cleared up resources for session 8bc75a6c-f324-11e8-9efc-0242ac120003
Extra client code snippet:
String user = env("ACTIVEMQ_USER", "admin");
String password = env("ACTIVEMQ_PASSWORD", "password");
String host = env("ACTIVEMQ_HOST", "10.20.40.20");
int port = Integer.parseInt(env("ACTIVEMQ_PORT", "19999"));
String destination = arg(args, 0, "/queue/reply");
External camel route:
<camel:route id="proxyreplyqueue">
<camel:from uri="stomp:queue:reply?login=admin&passcode=password"/>
<camel:to uri="log:input?showAll=true&level=INFO"/>
<camel:to uri="bean:replyHandlerService"/>
</camel:route>
Internal camel route:
<camel:route id="profproxyqueue">
<camel:from uri="activemq:queue:registration?username=admin&password=xxxxx"/>
<camel:to uri="stomp:queue:stompregister"/>
</camel:route>
Add this to your STOMP acceptor(s) in the Artemis broker.xml file:
anycastPrefix=/queue/;multicastPrefix=/topic/
For example:
<acceptor name="stomp">tcp://host:61613?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=STOMP;useEpoll=true;anycastPrefix=/queue/;multicastPrefix=/topic/</acceptor>
This tell the broker that STOMP messages sent to destinations beginning with /queue/ (like you are using) should be routed using anycast semantics rather than the default multicast semantics.
Ok well maybe there's more to it, but I've been fiddling with this for a week, and am pretty sure it just doesn't work as advertised.
I switched to using "activemq:queue:reply" instead of "stomp:queue:reply", and it's not perfect - but it handles STOMP messages, at least.

Wildfly 10 for jms messaging

I tried a simple spring jms example and deployed in tomee worked fine (din't start activemq server). Then I migrated to wildfly 10. But here i need to start activemq server. Is it needed wildfly is already integrated with activemq right? On starting the server (standalone.bat) should start the activemq isn't?
EDIT: Actually some configuration has been changed (I was not aware of the change). I unzipped wildfly 10 again and tried to deploy using "standalone.bat -c standalone-full.xml". Server started successfully but got the below given error.
10:29:26,172 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 10.0.0.Final (WildFly Core 2.0.10.Final) started in 13367ms - Started 401 of 691 services (397 services are lazy, passive or on-demand)
10:29:29,101 INFO [org.springframework.jms.listener.DefaultMessageListenerContainer] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) JMS message listener invoker needs to establish shared Connection
10:29:30,111 ERROR [org.springframework.jms.listener.DefaultMessageListenerContainer] (org.springframework.jms.listener.DefaultMessageListenerContainer#0-1) Could not refresh JMS Connection for destination 'myMessageQueue' - retrying in 5000 ms. Cause: Could not connect to broker URL: tcp://localhost:61616. Reason: java.net.ConnectException: Connection refused: connect
I managed to fix this problem by adding an embedded broker to my springcontext.xml
<amq:broker id="broker" useJmx="false" persistent="false">
<amq:transportConnectors>
<amq:transportConnector uri="tcp://localhost:61617" />
</amq:transportConnectors>
</amq:broker>
Refered : http://activemq.apache.org/how-do-i-embed-a-broker-inside-a-connection.html

WS02 JMS transport for Websphere MQ

After looking for a couple of days I have the problem to consume message from IBM MQ. I followed the documentation, but still, the system is not working fine. I'm using 4.8.0 and MQ 7.5.0.2
error
[2014-02-06 01:06:14,341] ERROR - JMSListener Unable to continue server startup as it seems the JMS Provider is not yet started. Please start the JMS provider now.
[2014-02-06 01:06:14,342] ERROR - JMSListener Connection attempt : 1 for JMS Provider failed. Next retry in 20 seconds
[2014-02-06 01:06:34,364] ERROR - JMSListener Unable to continue server startup as it seems the JMS Provider is not yet started. Please start the JMS provider now.
[2014-02-06 01:06:34,365] ERROR - JMSListener Connection attempt : 2 for JMS Provider failed. Next retry in 40 seconds
root#sandbox:/opt/wso2esb-4.8.0/FFDC# more JMSCC0001.FDC
----------------------------------START FFST------------------------------------
/opt/wso2esb-4.8.0/FFDC/JMSCC0001.FDC PID:5897
JMS Common Client First Failure Symptom Report
Product :- IBM WebSphere MQ classes for JMS
Date/Time :- Thu Feb 06 00:54:07 CET 2014
System time :- 1391644447539
Operating System :- SunOS
UserID :- root
Java Vendor :- Oracle Corporation
Java Version :- 23.3-b01
Source Class :- com.ibm.mq.jms.MQQueueConnectionFactory
Source Method :- readObject()
ProbeID :- XF001003
Thread :- name=localhost-startStop-1 priority=5 group=main ccl=org.eclipse.core.runtime.internal.adaptor.ContextFinder#1da36ad
axis2 config
<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
<parameter name="default" locked="false">
<parameter name="java.naming.factory.initial" locked="false">com.sun.jndi.fscontext.RefFSContextFactory</parameter>
<parameter name="java.naming.provider.url" locked="false">file:///var/tmp/jndi</parameter>
<parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">ivtQCF</parameter>
<parameter name="transport.jms.ConnectionFactoryType" locked="false">queue</parameter>
<parameter name="transport.jms.Destination" locked="false">ivtQ</parameter>
</parameter>
</transportReceiver>
test jndi is working
java JmsJndiConsumer -i file:///var/tmp/jndi -c ivtQCF -d ivtQ
Initial context found!
Received message:
JMSMessage class: jms_text
JMSType: null
JMSDeliveryMode: 2
JMSExpiration: 0
JMSPriority: 4
JMSMessageID: ID:414d5120514d412020202020202020204424ee5203db0020
JMSTimestamp: 1391646438379
JMSCorrelationID: null
JMSDestination: queue://QMA/QUEUE1
JMSReplyTo: null
JMSRedelivered: false
JMSXAppID: JmsJndiProducer
JMSXDeliveryCount: 1
JMSXUserID: webservd
JMS_IBM_Character_Set: UTF-8
JMS_IBM_Encoding: 273
JMS_IBM_Format: MQSTR
JMS_IBM_MsgType: 8
JMS_IBM_PutApplType: 28
JMS_IBM_PutDate: 20140206
JMS_IBM_PutTime: 00271840
JmsJndiProducer: Your lucky number today is 324
proxy
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="StockQuoteProxy2"
transports="jms"
startOnLoad="true"
trace="disable">
<description/>
<target>
<endpoint>
<address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
</endpoint>
<inSequence>
<property name="OUT_ONLY" value="true"/>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
<parameter name="transport.jms.ContentType">
<rules>
<jmsProperty>contentType</jmsProperty>
<default>application/xml</default>
</rules>
</parameter>
</proxy>
I've check the network and i cannot see any connecton form esb to mq server.
Any idea ?
update
I have configured the axis server in the sample ($WSO2_HOME/samples/axis2Server/repository/conf/axis2.xml) with exactly the same jms transport (default).
Atfer compiling the 'SimpleStockQuoteService' and starting the the server i can see that is working fine.
cd wso2esb-4.8.1/samples/axis2Server/src/SimpleStockQuoteService/ && ant
cd wso2esb-4.8.1/samples/axis2Server/ && ./axis2server.sh
14/02/10 21:20:29 INFO jms.JMSListener: JMS listener started
14/02/10 21:20:30 INFO jms.JMSListener: Connection attempt: 1 for JMS Provider for
service: SimpleStockQuoteService was successful!
14/02/10 21:20:30 INFO jms.ServiceTaskManager: Task manager for service :
SimpleStockQuoteService [re-]initialized
14/02/10 21:20:31 INFO jms.JMSListener: Started to listen on destination : ivtQ of
type queue for service SimpleStockQuoteService
14/02/10 21:20:31 INFO util.SampleAxis2ServerManager: [SimpleAxisServer] Started
I still not understand why is not working inside carbon !!!
The only way I found to made it work is to modify the startup script (ws02server.sh) to add the MQ client java library to the classpath
CARBON_CLASSPATH=/opt/mqm/java/lib/com.ibm.mq.jar:/opt/mqm/java/lib/com.ibm.mqjms.jar:"$CARBON_CLASSPATH"
If MQ transport type is BIND (ws02 on the same server as the MQ server) the JNI library need also to be included (-Djava.library.path=/opt/mqm/java/lib)
Copying the MQ java library to the repository/component/lib as stated in the documentation is not working.
Tested with MQ 7.5.0.2 and ws02 4.8.1 on Solaris and RHEL7

Active MQ clustering using http auto discovery with multi cast on Amazon EC2

We are trying to set up the active MQ cluster on production environment on Amazon EC2 with Auto discover and multicast.
I was able to configure successfully auto discovery with multi-cast on my local active mq server but on Amazon EC2 it is not working.
From the link
I found that Amazon EC2 does not support multi-cast. Hence we have to use HTTP transport or VPN for multi-cast. I tried HTTP transport for multi-cast by downloading activemq-optional-5.6.jar (we are using Active-MQ 5.6 version). It requires httpcore and httpClient jars to servlet in it class path.
In broker configuration(activemq.xml)
`
&ltnetworkConnectors>
&ltnetworkConnector name="default" uri="http://localhost:8161/activemq/DiscoveryRegistryServlet"/>
&lt/networkConnectors>
&lttransportConnectors>
&lttransportConnector name="activemq" uri="tcp://localhost:61616" discoveryUri="http://localhost:8161/activemq/DiscoveryRegistryServlet"/>
&lt/transportConnectors>`
are added.
But broker is not identifying the DiscoveryRegistryServlet.
Any help is much appreciated.
Finally figured out how to setup active MQ auto discovery with HTTP
Active-MQ Broker configuration:
In $ACTIVEMQ_HOME/webapps folder create a new folder
|_activemq
|_WEB-INF
|_classes
|_web.xml
create a web.xml file with the following contents
&ltweb-app>
&ltdisplay-name>ActiveMQ Message Broker Web Application&lt/display-name>
&ltdescription>
Provides an embedded ActiveMQ Message Broker embedded inside a web application
&lt/description>
&lt!-- context config -->
&ltcontext-param>
&ltparam-name>org.apache.activemq.brokerURL&lt/param-name>
&ltparam-value>tcp://localhost:61617&lt/param-value>
&ltdescription>The URL that the embedded broker should listen on in addition to HTTP&lt/description>
&lt/context-param>
&lt!-- servlet mappings -->
&ltservlet>
&ltservlet-name>DiscoveryRegistryServlet&lt/servlet-name>
&ltservlet-class>org.apache.activemq.transport.discovery.http.DiscoveryRegistryServlet&lt/servlet-class>
&ltload-on-startup>1&lt/load-on-startup>
&lt/servlet>
&ltservlet-mapping>
&ltservlet-name>DiscoveryRegistryServlet&lt/servlet-name>
&lturl-pattern>/*&lt/url-pattern>
&lt/servlet-mapping>
&lt/web-app>
Place httpclient-4.0.3.jar, httpcore-4.3.jar, xstream-1.4.5.jar and activemq-optional-5.6.0.jar in $ACTIVEMQ_HOME/lib directory.
In $ACTIVEMQ_HOME/config directory, modify the jetty.xml file to expose activemq web app.
&ltbean id="securityHandler" class="org.eclipse.jetty.security.ConstraintSecurityHandler">
...
&ltproperty name="handler">
&ltbean id="sec" class="org.eclipse.jetty.server.handler.HandlerCollection">
&ltproperty name="handlers">
...
...
&ltbean class="org.eclipse.jetty.webapp.WebAppContext">
&ltproperty name="contextPath" value="/activemq" />
&ltproperty name="resourceBase" value="${activemq.home}/webapps/activemq" />
&ltproperty name="logUrlOnStart" value="true" />
&ltproperty name="parentLoaderPriority" value="true" />
...
...
&lt/list>
&lt/property>
&lt/bean>
&lt/property>
&lt/bean>
Modify activemq.xml file in $ACTIVEMQ_HOME/conf directory to use http protocol
&ltbroker name=”brokerName”>
...
&ltnetworkConnectors>
&ltnetworkConnector name="default" uri="http://&ltloadbalancer_IP>:&ltlocadbalancer_Port>/activemq/DiscoveryRegistryServlet?group=test"/>
&lt!--&ltnetworkConnector name="default-nc" uri="multicast://default"/>-->
&lt/networkConnectors>
&lttransportConnectors>
&lttransportConnector name="http" uri="tcp://0.0.0.0:61618" discoveryUri="http://&ltloadbalancer_IP>:&ltlocadbalancer_Port>/activemq/test"/>
&lt/transportConnectors>
...
&lt/broker>
make sure that the broker names are unique. “test” in url is the group name of brokers.
Client configuration:
1. Keep httpclient-4.0.3.jar, httpcore-4.3.jar, xstream-1.4.5.jar and activemq-optional-5.6.0.jar in classpath of client
2. URL to be use by client
discovery:(http://&ltloadbalancer_IP>:&ltlocadbalancer_Port>/activemq/test)connectionTimeout=10000
here “test” is the group name.

Resources