Я использую Spring 4, Hibernate и ActiveMQ с использованием API REST
Конфигурации ActiveMQ
<bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
<property name="connectionFactory" ref="connectionFactory"></property>
</bean>
<!-- Configuration for Publishing Jms Messages -->
<bean id="activeMqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://localhost:61616"/>
<property name="disableTimeStampsByDefault" value="true"/>
<property name="useAsyncSend" value="true"/>
<property name="nonBlockingRedelivery" value="true"/>
<property name="redeliveryPolicy" ref="redeliveryPolicy"/>
</bean>
<bean id="redeliveryPolicy" class="org.apache.activemq.RedeliveryPolicy">
<property name="initialRedeliveryDelay" value="60000"/>
<property name="backOffMultiplier" value="3"/>
<property name="maximumRedeliveryDelay" value="60000"/>
<property name="maximumRedeliveries" value="3"/>
<property name="redeliveryDelay" value="60000"/>
<property name="useExponentialBackOff" value="true"/>
</bean>
<!--<bean id="outgoingSmsQueue" class="org.apache.activemq.command.ActiveMQQueue">
<property name="physicalName" value="queue/outgoingSmsQueue"/>
</bean>
<bean id="emailServiceQueue" class="org.apache.activemq.command.ActiveMQQueue">
<property name="physicalName" value="queue/emailServiceQueue"/>
</bean>-->
<bean id="activemqOrderQueue" class="org.apache.activemq.command.ActiveMQQueue">
<property name="physicalName" value="ActiveMQ.orderQueue"/>
</bean>
<bean id="activemqDLQ" class="org.apache.activemq.command.ActiveMQQueue">
<property name="physicalName" value="ActiveMQ.DLQ"/>
</bean>
<bean id="connectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
<property name="targetConnectionFactory" ref="activeMqConnectionFactory"/>
<property name="sessionCacheSize" value="200"/>
<property name="cacheProducers" value="true"/>
<property name="cacheConsumers" value="true"/>
</bean>
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="connectionFactory"/>
<property name="sessionTransacted" value="true"/>
<property name="deliveryPersistent" value="true"/>
<property name="explicitQosEnabled" value="true"/>
<property name="messageIdEnabled" value="false"/>
<property name="messageTimestampEnabled" value="false"/>
</bean>
<bean id="jmsProducer" class="com.mahopos.jms.JmsProducerImpl">
<property name="jmsTemplate" ref="jmsTemplate"/>
</bean>
<!-- End Configuration for Publishing Jms Messages -->
<bean id="dlqMessageListener" class="com.mahopos.jms.DlqMessageListener" autowire="byName">
</bean>
<bean id="dlqMessageListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer"
parent="baseMessageListenerContainer">
<property name="destination" ref="activemqDLQ"/>
<property name="messageListener" ref="dlqMessageListener"/>
</bean>
<bean id="baseMessageListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer"
abstract="true">
<property name="connectionFactory" ref="connectionFactory"/>
<property name="transactionManager" ref="jmsTransactionManager"/>
<property name="concurrentConsumers" value="10"/>
<property name="maxConcurrentConsumers" value="10"/>
<property name="idleConsumerLimit" value="1"/>
<property name="receiveTimeout" value="5000"/>
<property name="idleTaskExecutionLimit" value="50"/>
<property name="cacheLevel">
<util:constant
static-field="org.springframework.jms.listener.DefaultMessageListenerContainer.CACHE_CONSUMER"/>
</property>
</bean>
<bean id="orderQueueListener" class="com.mahopos.jms.OrderQueueListener">
<property name="demoApiService" ref="demoApiService"/>
<property name="delay" value="1500"/>
</bean>
<bean id="orderQueueListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer"
parent="baseMessageListenerContainer">
<property name="concurrentConsumers" value="5"/>
<property name="destination" ref="activemqOrderQueue"/>
<property name="messageListener" ref="orderQueueListener"/>
<property name="sessionTransacted" value="true"/>
</bean>
Видимо, похоже, что ContextLoaderListener инициализируется более одного раза, но где?
Сервер работает успешно, но прикрепленное изображение отображается в Chrome (браузер), и после запуска сервера вызов REST не выполняется.