Hi all,

I am facing an issue while developing a basic application of server client.
Each client will have a dedicated client queue to consume message from the
server and a single queue for a server to consume messages from the clients.

I am using apache-activemq-5.8.0 with spring framework.
This is my configuration file :
<?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:context="http://www.springframework.org/schema/context";
     xmlns:jms="http://www.springframework.org/schema/jms";
      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://www.springframework.org/schema/jms 
                          
http://www.springframework.org/schema/jms/spring-jms.xsd
                           http://activemq.apache.org/schema/core 
                          
http://activemq.apache.org/schema/core/activemq-core.xsd";>

    <context:component-scan base-package="com.test.common.orderapp" />
    <context:annotation-config/>

    <bean id="connectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL">
            <value>tcp://localhost:61616</value>
        </property>
        <property name=""></property>
    </bean>
    
    <bean id="worker1" class="org.apache.activemq.command.ActiveMQQueue">
        <constructor-arg value="worker1Queue"/>
    </bean>
    
    <bean id="worker2" class="org.apache.activemq.command.ActiveMQQueue">
        <constructor-arg value="worker2Queue"/>
    </bean>
    
    <bean id="response" class="org.apache.activemq.command.ActiveMQQueue" >
        <constructor-arg value="responseQueue"/>
    </bean>
        
    <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
        <property name="connectionFactory" ref="connectionFactory" />
        <property name="defaultDestination" ref="worker1" />
    </bean>
    
    
    
    
        <bean id="orderSender"
class="com.test.common.orderapp.producer.OrderSender"> </bean>
    
    <bean id="orderService"
class="com.test.common.orderapp.producer.OrderService">
        <property name = "orderSender" ref = "orderSender" />
    </bean>
      
        <bean id="orderListener"
class="com.test.common.orderapp.listener.OrderListener"> </bean>

                <jms:listener-container
              container-type="default"
              connection-factory="connectionFactory"
              acknowledge="auto" >
                <jms:listener destination="responseQueue" ref="orderListener"
method="orderReceived" />
                </jms:listener-container>
                                
</beans>

My question is:

There are basically two client with worker1 and worker2 queue.
Now whenever I load configuration file using 
ApplicationContext ctx = new
ClassPathXmlApplicationContext("app-context.xml");
            OrderService orderService = (OrderService) 
ctx.getBean("orderService");

"and send the message to any queue of worker a consumer is created on
response queue."

like
worker Queue: Consumer 1 Enqueue 10 Dequeue 10
Response Queue: Consumer 11 Enqueue 1 Dequeue 1

Some time messages also remain in pending state .

What can be the reason? Is my approach wrong ??

Thanks ,
Mohit Jain
 



--
View this message in context: 
http://activemq.2283324.n4.nabble.com/Consumer-is-created-when-a-message-is-sent-on-other-queue-tp4669768.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to