qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robbie Gemmell <robbie.gemm...@gmail.com>
Subject Re: java broker with jms and point to point
Date Thu, 27 Sep 2012 13:54:56 GMT
Thats my fault for just dropping that second Address in there without fully
thinking it through. It will as you have found work fine for the producer
in this case, but when it comes to the Consumer its still going to think it
is a topic 'node' and create a temp queue and bind it to the axchange
(amq.direct) with the subject (shiftqueue) from the Address.

You'll instead need to use something more like the first Address (though
note from the documentation that specifying the create options and node
type as I did is actually optional, as long as there isnt an exchange and a
queue of the same name it will find it without specifying the type, but I
prefer to be explicit about the desired behaviour).

Robbie

On 27 September 2012 14:28, oggie <gogden@gmail.com> wrote:

> Thanks Robbie, I appreciate it.  The address change was the problem. I used
> 'amq.direct/shiftqueue' and it worked.
>
> I'll look into making the changes to JNDI at some point in the future.
>
> I now have data going into the correct queue without a consumer connected.
>
> But once I connect my consumer, it creates the temp queues instead of
> connecting to the shiftqueue.  Not sure why it's behaving that way
> either...
>
> It's a message listener:
>
>
> public final class CPEMessageListener implements MessageListener {
>     @Override
>     public void onMessage(final Message message) {
>         try {
>             BytesMessage bytesMessage = (BytesMessage) message;
>             byte[] data = new byte[(int) bytesMessage.getBodyLength()];
>             bytesMessage.readBytes(data);
>             logger.debug("Consumed message: " + data.toString());
>         } catch (JMSException e) {
>             logger.error(e);
>             //TODO - we need to handle the error and determine if we should
> exit or keep running.
>         }
>     }
> }
>
>
> My spring config:
>
>
>
>     <bean id="connectionFactory"
> class="org.apache.qpid.client.AMQConnectionFactory">
>         <constructor-arg index="0"
>
> value="amqp://admin:admin@clientid
> /shift?brokerlist='tcp://localhost:5672'"
> />
>     </bean>
>
>
>     <bean id="messageListener" class="com.blah.CPEMessageListener">
>     </bean>
>
>
>     <jms:listener-container concurrency="5-10" acknowledge="client">
>         <jms:listener destination="amq.direct/shiftqueue"
> ref="messageListener"/>
>     </jms:listener-container>
>
>
>     <bean id="cachedConnectionFactory"
>
> class="org.springframework.jms.connection.CachingConnectionFactory"
>           p:targetConnectionFactory-ref="connectionFactory"
>           p:sessionCacheSize="1" />
>
>
>     <bean id="destination"
>           class="org.apache.qpid.client.AMQAnyDestination">
>         <constructor-arg value="amq.direct/shiftqueue" />
>     </bean>
>
>
> Not sure why it doesn't connect to the shiftqueue.
>
>
>
>
>
> --
> View this message in context:
> http://qpid.2158936.n2.nabble.com/java-broker-with-jms-and-point-to-point-tp7582591p7582677.html
> Sent from the Apache Qpid users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message