Open Liberty JMS with ActiveMQ jmsActivationSpec not triggering - jms

I'm trying to use activeMq as a broker for JMS with open liberty. I managed to get messages on the queue but my activation spec is never triggering. I'm reading the following in the logs.
[25/07/20 18:13:51:857 CEST] 00000330 com.ibm.ws.ejbcontainer.runtime.AbstractEJBRuntime I CNTR0180I: The FailedKalenderUpdateProcessor message-driven bean in the typedagkalender-backend.jar module of the typedagkalender-ear application is bound to the jms/typedagkalender/kalenderupdates/dlqueueAS activation specification.
[25/07/20 18:13:51:857 CEST] 00000330 com.ibm.ws.jca.cm.ConnectorService I J2CA8050I: An authentication alias should be used instead of defining a user name and password on jms/typedagkalender/kalenderupdates/dlqueueAS.
[25/07/20 18:13:51:858 CEST] 00000330 SystemOut O 2020-07-25 18:13:51,858 [utor-thread-692] INFO ActiveMQEndpointWorker - Starting
[25/07/20 18:13:51:858 CEST] 00000330 com.ibm.ws.jca.service.EndpointActivationService I J2CA8801I: The message endpoint for activation specification jms/typedagkalender/kalenderupdates/dlqueueAS and message driven bean application typedagkalender-ear#typedagkalender-backend.jar#FailedKalenderUpdateProcessor is activated.
[25/07/20 18:13:51:858 CEST] 00000330 com.ibm.ws.ejbcontainer.runtime.AbstractEJBRuntime I CNTR0180I: The KalenderUpdateProcessor message-driven bean in the typedagkalender-backend.jar module of the typedagkalender-ear application is bound to the jms/typedagkalender/kalenderupdates/queueAS activation specification.
[25/07/20 18:13:51:858 CEST] 000002cb SystemOut O 2020-07-25 18:13:51,858 [utor-thread-591] INFO ActiveMQEndpointWorker - Establishing connection to broker [tcp://localhost:61616]
[25/07/20 18:13:51:858 CEST] 00000330 com.ibm.ws.jca.cm.ConnectorService I J2CA8050I: An authentication alias should be used instead of defining a user name and password on jms/typedagkalender/kalenderupdates/queueAS.
[25/07/20 18:13:51:860 CEST] 00000330 SystemOut O 2020-07-25 18:13:51,859 [utor-thread-692] INFO ActiveMQEndpointWorker - Starting
[25/07/20 18:13:51:860 CEST] 00000330 com.ibm.ws.jca.service.EndpointActivationService I J2CA8801I: The message endpoint for activation specification jms/typedagkalender/kalenderupdates/queueAS and message driven bean application typedagkalender-ear#typedagkalender-backend.jar#KalenderUpdateProcessor is activated.
[25/07/20 18:13:51:860 CEST] 0000032b SystemOut O 2020-07-25 18:13:51,860 [utor-thread-687] INFO ActiveMQEndpointWorker - Establishing connection to broker [tcp://localhost:61616]
[25/07/20 18:13:51:870 CEST] 000002cb SystemOut O 2020-07-25 18:13:51,870 [utor-thread-591] INFO ActiveMQEndpointWorker - Successfully established connection to broker [tcp://localhost:61616]
[25/07/20 18:13:51:871 CEST] 0000032b SystemOut O 2020-07-25 18:13:51,870 [utor-thread-687] INFO ActiveMQEndpointWorker - Successfully established connection to broker [tcp://localhost:61616]
This is my server.xml configuration the jms part
<?xml version="1.0" encoding="UTF-8"?>
<server>
<!-- JMS CONFIGURATION -->
<resourceAdapter id="ActiveMQResourceAdapter" location="${server.config.dir}/resources/lib/resource-adapter/activemq-rar-5.16.0.rar">
<properties.activemq ServerUrl="tcp://localhost:61616" />
</resourceAdapter>
<messagingEngine>
<queue id="Typedagkalender_destination" />
<queue id="_SYSTEM.Exception.Destination" />
</messagingEngine>
<jmsQueueConnectionFactory jndiName="jms/typedagkalender/kalenderupdates/queueCF" connectionManagerRef="ConMgr">
<properties.ActiveMQResourceAdapter />
</jmsQueueConnectionFactory> -->
<connectionManager id="ConMgr" maxPoolSize="${jms.ConMgr.maxPoolSize}" />
<jmsQueue id="jms/typedagkalender/kalenderupdates/queue" jndiName="jms/typedagkalender/kalenderupdates/queue">
<properties.ActiveMQResourceAdapter PhysicalName="Typedagkalender_destination" />
</jmsQueue>
<jmsQueue id="jms/typedagkalender/kalenderupdates/dlqueue" jndiName="jms/typedagkalender/kalenderupdates/dlqueue">
<properties.ActiveMQResourceAdapter PhysicalName="_SYSTEM.Exception.Destination" />
</jmsQueue>
<jmsActivationSpec id="jms/typedagkalender/kalenderupdates/queueAS">
<properties.ActiveMQResourceAdapter destinationType="javax.jms.Queue" destination="jms/typedagkalender/kalenderupdates/queue" />
</jmsActivationSpec>
<jmsActivationSpec id="jms/typedagkalender/kalenderupdates/dlqueueAS">
<properties.ActiveMQResourceAdapter destinationType="javax.jms.Queue" destination="jms/typedagkalender/kalenderupdates/dlqueue" />
</jmsActivationSpec>
</server>
This is my bean that should activate
#TransactionAttribute(NOT_SUPPORTED)
#MessageDriven(mappedName = "jms/typedagkalender/kalenderupdates/queue", activationConfig = {
#ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
#ActivationConfigProperty(propertyName = "destination", propertyValue = "jms/typedagkalender/kalenderupdates/queue")
})
public class KalenderUpdateProcessor implements MessageListener {
private static final Logger LOGGER = LoggerFactory.getLogger(KalenderUpdateProcessor.class);
#Inject
private KalenderAbonnementService kalenderAbonnementService;
#Override
public void onMessage(Message message) {
if (!(message instanceof TextMessage)) {
LOGGER.error("Er is alleen ondersteuning voor TextMessages");
return;
}
Auditor.setTimestamp(now());
TextMessage textMessage = (TextMessage) message;
try {
LOGGER.debug("Textmessage gekregen voor KalenderJaargangVersieUpdate {}", textMessage.getText());
handle(textMessage.getText());
} catch (JMSException e) {
LOGGER.error("Fout tijdens behandelen van message {}: {}", textMessage, e);
throw new KalenderUpdateNotificationException("Fout tijdens behandelen van message " + textMessage, e);
} finally {
Auditor.destroy();
}
}
}
This setup works if I use the internal JMS implementation that open liberty provides. But since that would only work for a single node and I need a persistent central broker, I need to get it to work with activeMQ. What am I missing in this configuration ?

I found the solution, seems I can't use a different physicalname for the queue or it won't work. Well solution is a big word here maybe, maybe I have to say I didn't find a way to make it work with a different physicalname but did by using the same queue name.
<?xml version="1.0" encoding="UTF-8"?>
<server>
<!-- JMS CONFIGURATION -->
<resourceAdapter id="ActiveMQResourceAdapter" location="${server.config.dir}/resources/lib/resource-adapter/activemq-rar-5.16.0.rar">
<properties.activemq ServerUrl="tcp://localhost:61616" />
</resourceAdapter>
<messagingEngine>
<queue id="jms/typedagkalender/kalenderupdates/queue" />
<queue id="jms/typedagkalender/kalenderupdates/dlqueue" />
</messagingEngine>
<jmsQueueConnectionFactory jndiName="jms/typedagkalender/kalenderupdates/queueCF" connectionManagerRef="ConMgr">
<properties.ActiveMQResourceAdapter />
</jmsQueueConnectionFactory> -->
<connectionManager id="ConMgr" maxPoolSize="${jms.ConMgr.maxPoolSize}" />
<jmsQueue id="jms/typedagkalender/kalenderupdates/queue" jndiName="jms/typedagkalender/kalenderupdates/queue">
<properties.ActiveMQResourceAdapter PhysicalName="jms/typedagkalender/kalenderupdates/queue" />
</jmsQueue>
<jmsQueue id="jms/typedagkalender/kalenderupdates/dlqueue" jndiName="jms/typedagkalender/kalenderupdates/dlqueue">
<properties.ActiveMQResourceAdapter PhysicalName="jms/typedagkalender/kalenderupdates/dlqueue" />
</jmsQueue>
<jmsActivationSpec id="jms/typedagkalender/kalenderupdates/queueAS">
<properties.ActiveMQResourceAdapter destinationType="javax.jms.Queue" destination="jms/typedagkalender/kalenderupdates/queue" />
</jmsActivationSpec>
<jmsActivationSpec id="jms/typedagkalender/kalenderupdates/dlqueueAS">
<properties.ActiveMQResourceAdapter destinationType="javax.jms.Queue" destination="jms/typedagkalender/kalenderupdates/dlqueue" />
</jmsActivationSpec>
</server>

Related

Camel Spring remoting with Artemis Proton/Qpid client - hangs sending message

When i use the Camel spring remoting configuration to send some message, both the producer and consumer are running in different JVM.
using Apache artemis 2.14.0 version
version of camel (2.20.0), qpid (0.54.0), pooled-jms (1.1.1)
i was using the LoadMessageSupport class to push message, i see the camel routes are invoked and below debug log message.
I noticed a producer session enabled in the Artemis console.
Any clue, how to debug this or what might cause this issue.
There were some netty related debug errors which i safely ignored.
...
DEBUG [main] (DefaultManagementAgent.java:470) - Registered MBean with ObjectName: org.apache.camel:context=camel,type=components,name="bean"
DEBUG [main] (DefaultComponent.java:266) - Cannot resolve property placeholders on component: org.apache.camel.component.bean.BeanComponent#cda0432 as PropertiesComponent is not in use
DEBUG [main] (AbstractAutowireCapableBeanFactory.java:448) - Creating instance of bean 'org.apache.camel.component.jackson.converter.JacksonTypeConverters'
DEBUG [main] (AbstractAutowireCapableBeanFactory.java:484) - Finished creating instance of bean 'org.apache.camel.component.jackson.converter.JacksonTypeConverters'
INFO [main] (CamelLogger.java:159) - ID-local-vm-1624040900482-0-1 >>> (processMessage) from(direct://proxy-msg-handler) --> log[Log message on incoming message with body] <<< Pattern:InOnly, Headers:{breadcrumbId=ID-local-vm-1624040900482-0-1}, BodyType:org.apache.camel.component.bean.BeanInvocation, Body:BeanInvocation public abstract void com.myexample.MessageHandler.processMessage(com.myexample.MessageType,java.lang.String) with [ITEM_DESCRIPTION, {"info": " my name"}]]
DEBUG [main] (CamelLogger.java:153) - Log message on incoming message with body
INFO [main] (CamelLogger.java:159) - ID-local-vm-1624040900482-0-1 >>> (SubmitNotificationEvent) log[Log message on incoming message with body] --> amqpcomponent://queue:message.queue <<< Pattern:InOnly, Headers:{breadcrumbId=ID-local-vm-1624040900482-0-1}, BodyType:org.apache.camel.component.bean.BeanInvocation, Body:BeanInvocation public abstract void com.myexample.MessageHandler.processMessage(com.myexample.MessageType,java.lang.String) with [ITEM_DESCRIPTION, {"info": " my name"}]]
DEBUG [main] (SendProcessor.java:147) - >>>> service-event-queue://queue:message.queue Exchange[ID-local-vm-1624040900482-0-1]
DEBUG [main] (InternalLoggerFactory.java:45) - Using SLF4J as the default logging framework
...
DEBUG [AmqpProvider :(1):[amqp://localhost:5672]] (AmqpConnectionBuilder.java:84) - AmqpConnection { ID:6d0c8673-6a92-401d-a239-12ec696fc9d3:1 } is now open:
INFO [AmqpProvider :(1):[amqp://localhost:5672]] (JmsConnection.java:1339) - Connection ID:6d0c8673-6a92-401d-a239-12ec696fc9d3:1 connected to server: amqp://localhost:5672
DEBUG [main] (JmsTemplate.java:492) - Executing callback on JMS Session: JmsPoolSession { org.apache.qpid.jms.JmsSession#7fd26ad8 }
DEBUG [AmqpProvider :(1):[amqp://localhost:5672]] (AmqpProducerBuilder.java:68) - Creating AmqpFixedProducer for: null
DEBUG [main] (JmsConfiguration.java:622) - Sending JMS message to: message.queue with message: JmsObjectMessageFacade
After enabling the TRACE level Logs, noticed below msg
DEBUG [main] (JmsConfiguration.java:622) - Sending JMS message to: message.queue with message: JmsObjectMessageFacade { org.apache.qpid.jms.provider.amqp.message.AmqpJmsObjectMessageFacade#36cc9385 }
TRACE [AmqpProvider :(1):[amqp://localhost:5672]] (AmqpFixedProducer.java:100) - Holding Message send until credit is available.
TRACE [AmqpProvider :(1):[amqp://localhost:5672]] (AmqpProvider.java:1625) - IdleTimeoutCheck rescheduling with delay: 15000
TRACE [AmqpProvider :(1):[amqp://localhost:5672]] (NettyTcpTransport.java:560) - New incoming data read: PooledUnsafeDirectByteBuf(ridx: 0, widx: 8, cap: 65536)
TRACE [AmqpProvider :(1):[amqp://localhost:5672]] (AmqpProtocolTracer.java:49) - [1673389762:0] RECV: Empty Frame
TRACE [AmqpProvider :(1):[amqp://localhost:5672]] (AmqpProtocolTracer.java:54) - [1673389762:0] SENT: Empty Frame
TRACE [AmqpProvider :(1):[amqp://localhost:5672]] (NettyTcpTransport.java:259) - Attempted write of buffer: PooledUnsafeDirectByteBuf(ridx: 0, widx: 8, cap: 8/8)
TRACE [AmqpProvider :(1):[amqp://localhost:5672]] (NettyTcpTransport.java:273) - Attempted flush of pending writes
TRACE [AmqpProvider :(1):[amqp://localhost:5672]] (AmqpProvider.java:1625) - IdleTimeoutCheck rescheduling with delay: 15000
TRACE [AmqpProvider :(1):[amqp://localhost:5672]] (NettyTcpTransport.java:560) - New incoming data read: PooledUnsafeDirectByteBuf(ridx: 0, widx: 8, cap: 65536)
TRACE [AmqpProvider :(1):[amqp://localhost:5672]] (AmqpProtocolTracer.java:49) - [1673389762:0] RECV: Empty Frame
TRACE [AmqpProvider :(1):[amqp://localhost:5672]] (AmqpProtocolTracer.java:54) - [1673389762:0] SENT: Empty Frame
TRACE [AmqpProvider :(1):[amqp://localhost:5672]] (NettyTcpTransport.java:259) - Attempted write of buffer: PooledUnsafeDirectByteBuf(ridx: 0, widx: 8, cap: 8/8)
TRACE [AmqpProvider :(1):[amqp://localhost:5672]] (NettyTcpTransport.java:273) - Attempted flush of pending writes
TRACE [AmqpProvider :(1):[amqp://localhost:5672]] (AmqpProvider.java:1625) - IdleTimeoutCheck rescheduling with delay: 15000
Below is the context xml which i used to send message from java class.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd
http://www.springframework.org/schema/util ttp://www.springframework.org/schema/util/spring-util.xsd">
<bean id="jmsConnectionFactory" class="org.apache.qpid.jms.JmsConnectionFactory">
<property name="remoteURI" value="amqp://localhost:5672?amqp.traceFrames=true"/>
</bean>
<bean id="jpcf" class="org.messaginghub.pooled.jms.JmsPoolConnectionFactory" init-method="start" destroy-method="stop" >
<property name="maxConnections" value="3" />
<property name="connectionFactory" ref="jmsConnectionFactory" />
</bean>
<bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="jpcf" />
<property name="concurrentConsumers" value="3" />
</bean>
<bean id="amqpcomponent" class="org.apache.camel.component.amqp.AMQPComponent">
<property name="configuration" ref="jmsConfig" />
</bean>
<!-- Camel Spring Remoting Interface -->
<camel:proxy id="proxyObject" binding="false" serviceUrl="direct:proxy-msg-handler" serviceInterface="com.myexample.MessageHandler"/>
<!-- Bean that initialize the Spring Remoting for handling message -->
<bean id="BeanProxy" class="com.myexample.MessageProducer">
<property name="messageHandler" ref="proxyObject"/>
</bean>
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring" autoStartup="true" trace="true">
<camel:route autoStartup="true" id="processMessage">
<camel:from uri="direct:proxy-msg-handler"/>
<camel:log message="Log incoming message" logName="Incoming" loggingLevel="DEBUG"/>
<camel:inOnly uri="amqpcomponent:queue:message.queue"/>
</camel:route>
</camelContext>
</beans>
java class running the context, used to invoke the remote spring bean method.
Using below java class to push message to Artemis queue
package com.myexample;
public class LoadMessageSupport {
public static void main(String ...strings) {
ApplicationContext appContext =null;
try {
appContext = new ClassPathXmlApplicationContext("file:/paht/to/context/message-handler-context.xml");
MessageProducer messageProducer = appContext.getBean(MessageProducer.class);
message = "{ \"itemDesc\" : \"test description\" }" ;
System.out.println(message);
messageProducer.sendMessage(MessageType.ITEM_DESC, message);
// enum messagetype already defined within project
//System.exit(0);
}catch(Exception exe) {
System.out.println("Something wrong... ");
exe.printStackTrace();
}finally {
if(camelContext!=null) {
System.out.println("camel context stopped...");
camelContext.stop();
}
}
}
}
message receiver class
#InOnly
public interface MessageHandler{
public processMessage(MessageType type, Order order);
public processMessage(MessageType type, String message); // trying to invoke this message
}
producer class
public class MessageProducer{
​// using the proxy object within the producer object
​// this will invoke the spring bean using remote (rmi)
​private MessageHandler messageHandler;
protected MessageHandler getMessageHandler() {
return this.messageHandler;
}
public void setMessageHandler(MessageHandler messageHandler) {
this.messageHandler = messageHandler;
}
//constructor
public ​MessageProducer() {}
​
public void sendMessage(MessageType type, Order order ){
​getMessageHandler().processMessage(type,order);
​}
​public void sendMessage(MessageType type, String message ){
​getMessageHandler().processMessage(type,message);
​}
message Receiver
public class MessageReceiver implements MessageHandler {
#Handler
public void processMessage(MessageType type, Order order){
System.out.println(" received type and ORDER info ...");
// invoke methods for logical processing
}
#Handler
public void processMessage(MessageType type, String message){
System.out.println(" received type and MESSAGE info for procesing...");
// invoke methods for logical processing
}
}
When i was trying earlier, seems like my VM didn't have sufficient memory.
free -h indicate only 500MB left out.
After restarting the VM the message is now sent to Artemis borker.

JmsListener does not receive message from Activemq

I have a Spring JmsListener in my code. It's receive and consume message for 2 days but suddenly after this 2 days it receive no message from external activemq. However there is some pending message in its queue. When I reset the activemq and consumer, the consumer receive large amount of message. When the messages are pending the consumer connected to the activemq(on behalf of spring actuator logs).
The logs and config show that activemq did not push message to consumer. I have another services like this consumer that receive the message from other queue. Also the second consumer has same problem. I want to know why this problem happened and how can I solve this problem.
Here is my config and log:
Consumer:
application.xml:
spring.jms.pub-sub-domain=false
spring.jms.template.delivery-mode=persistent
spring.activemq.broker-url=${BROKER_URL:failover:(tcp://activemq1:61616,tcp://activemq2:61616)?maxReconnectDelay=2500}
spring.activemq.user=${BROKER_USER:admin}
spring.activemq.password=${BROKER_PASSWORD:admin}
JmsConfiguration:
#EnableJms
#Configuration
public class JmsConfiguration {
#Bean
public JmsListenerContainerFactory<?> myFactory(ActiveMQConnectionFactory connectionFactory,
DefaultJmsListenerContainerFactoryConfigurer configurer) {
DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
RedeliveryPolicy redeliveryPolicy = new RedeliveryPolicy();
redeliveryPolicy.setMaximumRedeliveries(0);
connectionFactory.setRedeliveryPolicy(redeliveryPolicy);
factory.setMessageConverter(messageConverter());
configurer.configure(factory, connectionFactory);
return factory;
}
private MessageConverter messageConverter() {
MappingJackson2MessageConverter messageConverter = new MappingJackson2MessageConverter();
messageConverter.setTargetType(MessageType.TEXT);
messageConverter.setTypeIdPropertyName("_type");
return messageConverter;
}
}
Listener:
#Component
public class MessageReceiver {
#JmsListener(destination = Constant.OFFICE_REQUEST_QUEUE, containerFactory = "myFactory")
public void receive(RequestMessage requestMessage, #Headers Map<String,Object> headers) throws NonPersistenceServiceException {
// do someting on received message
}
}
Activemq config:
activemq.xml:
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>file:${activemq.conf}/credentials.properties</value>
</property>
</bean>
<bean id="logQuery" class="io.fabric8.insight.log.log4j.Log4jLogQuery"
lazy-init="false" scope="singleton"
init-method="start" destroy-method="stop">
</bean>
<bean id="oracleDS" class="oracle.jdbc.pool.OracleDataSource" destroy-method="close">
<property name="URL" value="jdbc:oracle:thin:#(DESCRIPTION= (SDU=32768)(ADDRESS=(PROTOCOL=TCP)(HOST= dms-db1-vip)(PORT=1521)) (ADDRESS=(PROTOCOL=TCP)(HOST= dms-db2-vip)(PORT=1521)) (LOAD_BALANCE=yes)(FAILOVER=ON)(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)(failover_mode=(type=select)(method=basic)(retries=5)(delay=1))))"/>
<property name="user" value="ora_user"/>
<property name="password" value="ora_pass"/>
</bean>
<broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.data}" >
<plugins>
<redeliveryPlugin fallbackToDeadLetter="true"
sendToDlqIfMaxRetriesExceeded="true">
<redeliveryPolicyMap>
<redeliveryPolicyMap>
<defaultEntry>
<redeliveryPolicy
useExponentialBackOff="true"
backOffMultiplier="2"
maximumRedeliveryDelay="1200000"
maximumRedeliveries="82"/>
</defaultEntry>
</redeliveryPolicyMap>
</redeliveryPolicyMap>
</redeliveryPlugin>
</plugins>
<destinationPolicy>
<policyMap>
<policyEntries>
<policyEntry queue=">">
<deadLetterStrategy>
<individualDeadLetterStrategy queuePrefix="DLQ." useQueueForQueueMessages="true"/>
</deadLetterStrategy>
</policyEntry>
</policyEntries>
</policyMap>
</destinationPolicy>
<managementContext>
<managementContext createConnector="false"/>
</managementContext>
<persistenceAdapter>
<jdbcPersistenceAdapter dataSource="#oracleDS" />
</persistenceAdapter>
<systemUsage>
<systemUsage>
<memoryUsage>
<memoryUsage percentOfJvmHeap="70" />
</memoryUsage>
<storeUsage>
<storeUsage limit="100 gb"/>
</storeUsage>
<tempUsage>
<tempUsage limit="50 gb"/>
</tempUsage>
</systemUsage>
</systemUsage>
<transportConnectors>
<transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
</transportConnectors>
<shutdownHooks>
<bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook" />
</shutdownHooks>
</broker>
<import resource="jetty.xml"/>
</beans>
Below is The log of actuator in consumer:
{"log":"20:20:26.775 ### [ActiveMQ Task-1] INFO o.a.activemq.transport.failover.FailoverTransport ### ### ###\r\n","stream":"stdout"}
{"log":" Successfully connected to tcp://activemq1:61616\r\n","stream":"stdout"}
{"log":"20:20:36.638 ### [ActiveMQ Task-1] INFO o.a.activemq.transport.failover.FailoverTransport ### ### ###\r\n","stream":"stdout"}
{"log":" Successfully connected to tcp://activemq1:61616\r\n","stream":"stdout"}
{"log":"20:20:36.779 ### [ActiveMQ Task-1] INFO o.a.activemq.transport.failover.FailoverTransport ### ### ###\r\n","stream":"stdout"}
{"log":" Successfully connected to tcp://activemq1:61616\r\n","stream":"stdout"}
{"log":"20:20:46.464 ### [ActiveMQ Task-1] INFO o.a.activemq.transport.failover.FailoverTransport ### ### ###\r\n","stream":"stdout"}
{"log":" Successfully connected to tcp://activemq1:61616\r\n","stream":"stdout"}
{"log":"20:20:46.774 ### [ActiveMQ Task-1] INFO o.a.activemq.transport.failover.FailoverTransport ### ### ###\r\n","stream":"stdout"}
Activemq erros log:
2019-03-05 20:19:55,448 | WARN | Transport Connection to: tcp://10.42.1.0:63493 failed: java.io.IOException: Frame size of 1 GB larger than max allowed 100 MB | org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ Transport: tcp:///10.42.1.0:63493#61616
2019-03-05 20:20:05,776 | WARN | Transport Connection to: tcp://10.42.1.0:63498 failed: java.io.EOFException | org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ Transport: tcp:///10.42.1.0:63498#61616
2019-03-05 20:20:05,776 | WARN | Transport Connection to: tcp://10.42.1.0:63497 failed: java.io.EOFException | org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ Transport: tcp:///10.42.1.0:63497#61616
Such scenarios are most often the result of one of two issues:
Some network component (router, firewall) silently closes a socket due to inactivity without notifying the client or server so, unless heartbeats are enabled, the connection is dead.
The consumer thread is somehow "stuck" in user code so it stops receiving new messages; take a stack dump to see what the container threads are doing.

Is it possible to create a new RabbitMQ queue from a proxy in WSO2 ESB that previously didn’t exist?

We are using WSO2 with RabbitMQ in our project. One requirement is that the consumer of RabbitMQ should generate the queue in case it did not previously exist.
We make the following proxy (without creating the "queue" queue previously in the Rabbit broker):
<?xml version="1.0" encoding="UTF-8"?>
<proxy name="AMQPProxy3" startOnLoad="true" trace="enable" transports="rabbitmq" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<log level="full"/>
<property name="OUT_ONLY" scope="default" type="STRING" value="true"/>
<property name="FORCE_SC_ACCEPTED" scope="axis2" type="STRING" value="true"/>
<send>
<endpoint>
<address uri="http://localhost:8080/greeting"/>
</endpoint>
</send>
</inSequence>
<outSequence/>
<faultSequence/>
</target>
<parameter name="rabbitmq.queue.name">queue</parameter>
<parameter name="rabbitmq.connection.factory">AMQPConnectionFactory</parameter>
</proxy>
The ESB throws the following exception:
TID: [-1] [] [2017-08-25 13:23:06,139] ERROR {org.apache.axis2.transport.rabbitmq.ServiceTaskManager} - Error, Connection already closed AMQPProxy3, Listner id - 302 {org.apache.axis2.transport.rabbitmq.ServiceTaskManager}
com.rabbitmq.client.AlreadyClosedException: channel is already closed due to channel error; protocol method: #method(reply-code=404, reply-text=NOT_FOUND - no queue 'queue' in vhost '/', class-id=50, method-id=10)
In this case, the RabbitMQ consumer using the ESB does not create the queue in case it does not exist.
However, if we use a Java project that uses amqp-client-4.0.2.jar (Java library that gives us the official page of Rabbit) that consumer is able to create the queue.
package com.ing.rabbitmq;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
public class Send2 {
private final static String QUEUE_NAME = "queue";
public static void main(String[] argv) throws Exception {
ConnectionFactory factory = new ConnectionFactory();
factory.setHost("localhost");
Connection connection = factory.newConnection();
Channel channel = connection.createChannel();
channel.queueDeclare(QUEUE_NAME, false, false, false, null);
String message = "{\"id\":100,\"content\":\"Manolito\"}";
channel.basicPublish("", QUEUE_NAME, null, message.getBytes());
System.out.println(" [x] Sent '" + message + "'");
channel.close();
connection.close();
}
}
Could we get the ESB to create the queue just like if we used the java client (amqp-client-4.0.2.jar)?
I think it should be possible with WSO2 ESB.
Try setting out the following property in your proxy configuration.
<parameter name="rabbitmq.queue.autodeclare">true</parameter>
If that not works, please let me know the WSO2 ESB version you are using.

Websphere Liberty profile - transacted Websphere MQ connection factory

Trying to get my Liberty profile server to create a transacted jmsConnectionFactory to my instance of Websphere message queue.
Liberty profile v 8.5.5.5
Websphere MQ 7.x
I've tried to change the jmsQueueConnectionFactory to jmsXAQueueConnectionFactory but it does not help -> Then it seems to just ignore it and doesn't connect to the MQ
server.xml
<?xml version="1.0" encoding="UTF-8"?>
<server description="new server">
<!-- Enable features -->
<featureManager>
<feature>wmqJmsClient-1.1</feature>
<feature>jndi-1.0</feature>
<feature>jsp-2.2</feature>
<feature>localConnector-1.0</feature>
</featureManager>
<variable name="wmqJmsClient.rar.location" value="D:\wlp\wmq\wmq.jmsra.rar"/>
<jmsQueueConnectionFactory jndiName="jms/wmqCF" connectionManagerRef="ConMgr6">
<properties.wmqJms
transportType="CLIENT"
hostName="hostname"
port="1514"
channel="SYSTEM.DEF.SVRCONN"
queueManager="QM"
/>
</jmsQueueConnectionFactory>
<connectionManager id="ConMgr6" maxPoolSize="2"/>
<applicationMonitor updateTrigger="mbean"/>
<application id="App"
location="...\app.war"
name="App" type="war"/>
<!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
<httpEndpoint id="defaultHttpEndpoint"
httpPort="9080"
httpsPort="9443"/>
</server>
log
2015-04-23 17:07:14,981 [JmsConsumer[A0]] WARN ultJmsMessageListenerContainer - Setup of JMS message listener invoker failed for destination 'A0' - trying to recover. Cause: Could not commit JMS transaction; nested exception is com.ibm.msg.client.jms.DetailedIllegalStateException: JMSCC0014: It is not valid to call the 'commit' method on a nontransacted session. The application called a method that must not be called on a nontransacted session. Change the application program to remove this behavior.
2015-04-23 17:07:14,983 [JmsConsumer[A0]] INFO ultJmsMessageListenerContainer - Successfully refreshed JMS Connection
Camel code
public static JmsComponent mqXAComponentTransacted(InitialContext context, String jndiName) throws JMSException, NamingException {
return JmsComponent.jmsComponentTransacted((XAQueueConnectionFactory) context.lookup(jndiName));
}
Ended up with:
public static JmsComponent mqXAComponentTransacted(InitialContext context, String connectionFactoryJndiName, String userTransactionJndiName) throws JMSException, NamingException {
LOG.info("Setting up JmsComponent using jndi lookup");
final JtaTransactionManager jtaTransactionManager = new JtaTransactionManager((UserTransaction) context.lookup(userTransactionJndiName));
final ConnectionFactory connectionFactory = (ConnectionFactory) context.lookup(connectionFactoryJndiName);
final JmsComponent jmsComponent = JmsComponent.jmsComponentTransacted(connectionFactory, (PlatformTransactionManager) jtaTransactionManager);
jmsComponent.setTransacted(false);
jmsComponent.setCacheLevel(DefaultMessageListenerContainer.CACHE_NONE);
return jmsComponent;
}

MyBatis-Spring setup not using transactions

I have a web application set up with MyBatis and Spring, but it doesn't seem to be using any transactions. Here's the configuration:
applicationContext.xml:
<tx:annotation-driven />
<!-- <tx:jta-transaction-manager /> --> <!-- using WebSphere 7 -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="jdbc/my_datasource" />
</bean>
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="configLocation" value="WEB-INF/mybatis-config.xml" />
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="testDAO" class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="com.lmig.TestDAO" />
<property name="sqlSessionFactory" ref="sqlSessionFactory" />
</bean>
Sample bean method with transaction definition:
#Transactional(propagation = Propagation.REQUIRED)
public void testDelete() {
testDAO.firstDelete(); //always successful
testDAO.secondDelete(); //always throws SQLServerException
}
TestDAO:
public interface TestDAO {
public void firstDelete();
public void secondDelete();
}
Server debug log:
[11/17/11 16:42:07:998 PST] 0000002b SystemOut O DEBUG [org.mybatis.spring.SqlSessionUtils] Creating SqlSession with JDBC Connection [com.ibm.ws.rsadapter.jdbc.WSJdbcConnection#34ba34ba]
[11/17/11 16:42:07:999 PST] 0000002b SystemOut O DEBUG [java.sql.Connection] ooo Connection Opened
[11/17/11 16:42:08:001 PST] 0000002b SystemOut O DEBUG [org.mybatis.spring.transaction.SpringManagedTransaction] JDBC Connection [com.ibm.ws.rsadapter.jdbc.WSJdbcConnection#34ba34ba] will be managed by Spring
[11/17/11 16:42:08:005 PST] 0000002b SystemOut O DEBUG [org.mybatis.spring.SqlSessionUtils] Registering transaction synchronization for SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession#74247424]
[11/17/11 16:42:08:025 PST] 0000002b SystemOut O DEBUG [java.sql.PreparedStatement] ==> Executing: delete from test1
[11/17/11 16:42:08:025 PST] 0000002b SystemOut O DEBUG [java.sql.PreparedStatement] ==> Parameters:
[11/17/11 16:42:08:097 PST] 0000002b SystemOut O DEBUG [org.mybatis.spring.SqlSessionUtils] Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession#74247424]
[11/17/11 16:42:08:099 PST] 0000002b SystemOut O DEBUG [org.mybatis.spring.SqlSessionUtils] Transaction synchronization committing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession#74247424]
[11/17/11 16:42:08:123 PST] 0000002b SystemOut O DEBUG [org.mybatis.spring.SqlSessionUtils] Transaction synchronization closing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession#74247424]
[11/17/11 16:42:08:136 PST] 0000002b SystemOut O DEBUG [org.mybatis.spring.SqlSessionUtils] Creating SqlSession with JDBC Connection [com.ibm.ws.rsadapter.jdbc.WSJdbcConnection#17351735]
[11/17/11 16:42:08:137 PST] 0000002b SystemOut O DEBUG [java.sql.Connection] ooo Connection Opened
[11/17/11 16:42:08:138 PST] 0000002b SystemOut O DEBUG [org.mybatis.spring.transaction.SpringManagedTransaction] JDBC Connection [com.ibm.ws.rsadapter.jdbc.WSJdbcConnection#17351735] will be managed by Spring
[11/17/11 16:42:08:139 PST] 0000002b SystemOut O DEBUG [org.mybatis.spring.SqlSessionUtils] Registering transaction synchronization for SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession#1d871d87]
[11/17/11 16:42:08:145 PST] 0000002b SystemOut O DEBUG [java.sql.PreparedStatement] ==> Executing: delete from test2
[11/17/11 16:42:08:146 PST] 0000002b SystemOut O DEBUG [java.sql.PreparedStatement] ==> Parameters:
[11/17/11 16:42:08:490 PST] 0000002b XmlBeanDefini I org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
[11/17/11 16:42:08:554 PST] 0000002b SQLErrorCodes I org.springframework.jdbc.support.SQLErrorCodesFactory <init> SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]
[11/17/11 16:42:08:560 PST] 0000002b SystemOut O DEBUG [org.mybatis.spring.SqlSessionUtils] Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession#1d871d87]
[11/17/11 16:42:08:597 PST] 0000002b SystemOut O DEBUG [org.mybatis.spring.SqlSessionUtils] Transaction synchronization closing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession#1d871d87]
...SQLServerException follows...
Since secondDelete() throws an exception, the entire transaction would be expected to roll back. However, this isn't the case, and the firstDelete() is still committed. I've tried all combinations of the transaction manager config (Spring-managed, app server-managed, both) but I keep getting the same results. Any idea what I'm doing wrong?
I'm using Mybatis 3, Spring 3 on WebSphere 7 with SQL Server 2005 as the DB.
I figured this out: my testDelete() method wasn't a Spring-managed bean, so it wasn't participating in Spring-managed transactions. I changed my configuration to this, and now it's working.

Resources