У меня есть автономный сервер hornetq и работающий с ним JMS-клиент! Что касается руководства пользователя hornetq, я должен добавить только jnp-client.jar и jms.jar в путь к классам клиента. Но когда я пытаюсь использовать сервер hornetq (создавать и потреблять сообщения), выбрасывается несколько исключений ClassNotFoundException, поэтому я принудительно добавляю эти jar-файлы в путь к классам моего клиента:
1. jms 2. jnp-client 3. hornetq-jms-client 4. netty 5. hornetq-core-cilent 6. jboss-common
Использую ли я основной клиент Hornetq вместо клиента jms?? Какие файлы jar мне действительно нужны для клиента jms??
Мое приложениеContext.xml:
<!-- JndiTemplate -->
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</prop>
<prop key="java.naming.factory.url.pkgs">org.jboss.naming:org.jnp.interfaces</prop>
<prop key="java.naming.provider.url">jnp://localhost:1099</prop>
</props>
</property>
</bean>
<!-- Connection Factory -->
<bean id="hornetqConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate" ref="jndiTemplate"/>
<property name="jndiName" value="/ConnectionFactory" />
</bean>
<!-- Destionation -->
<bean id="annotationDeleteCommandDestination" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate" ref="jndiTemplate"/>
<property name="jndiName" value="/queue/command/annotation/deleteQueue" />
</bean>
<!-- Message Listener -->
<bean id="annotationMessageHandler" class="command.messaging.handler.annotation.AnnotationMessageHandler">
<property name="annotationService" ref="annotationService"/>
</bean>
<!-- Message Listener Container -->
<bean id="annotationDeleteCommandMsgListenerContainer"
class="org.springframework.jms.listener.DefaultMessageListenerContainer"
p:connectionFactory-ref="hornetqConnectionFactory"
p:destination-ref="annotationDeleteCommandDestination"
p:cacheLevelName="CACHE_CONSUMER"
p:messageListener-ref="annotationDeleteCommandMessageHandler"
p:concurrentConsumers="10"
p:maxConcurrentConsumers="50"
p:receiveTimeout="5000"
p:idleTaskExecutionLimit="10
p:idleConsumerLimit="5" />
<!-- Message Producer -->
<bean id="messageSender" class="command.messaging.sender.MessageSender">
<property name="connectionFactory" ref="hornetqConnectionFactory" />
</bean>