Re: Java API querying the exchange from which the message originated
Hi guys, If I'm reading this right this relates to the javax.jms.Destination object associated with a javax.jms.Message. If that's the case (which I assume it is given the comment There is an exchange property in the headers and the library does use this to create a Destination object) Can I just check something? So does Jakub's symptom only happen after a call to |*getJMSDestination http://download.oracle.com/javaee/5/api/javax/jms/Message.html#getJMSDestination%28%29*()|? What I mean is that presumably there's no need to create the Destination object unless it has actually been asked for (lazy evaluation), so I'd agree with Jakub's comment that it is necessary evil to have the JMS Destination as the message property and not just the exchange name and routing key in a plain text but only for the case where the Destination has actually been requested. Frase Jakub Scholz wrote: Hi Gordon, I'm using Qpid 0.10. But I checked it again and you are right, it really seems to send the exchange query only once - I probably saw some older exchange queries before. I'm sorry for the mystification. I assume doing it once should be acceptable and it is necessary evil to have the JMS Destination as the message property and not just the exchange name and routing key in a plain text. Thanks Regards Jakub On Mon, Sep 5, 2011 at 12:06, Gordon Sim g...@redhat.com wrote: On 09/05/2011 10:27 AM, Jakub Scholz wrote: I believe the message contains some property describing the originating exchange. I assume the exchange query may be sent when parsing this property, since that is the only one linking to exchange X. You are right. There is an exchange property in the headers and the library does use this to create a Destination object. To do that it needs to know the exchange type and issues a query if it does not. It does cache that information however, so should not query for every message (assuming the same exchange name). That doesn't match what you are seeing? What version of the client are you using? There was a similar sounding issue with reply-to, but that was based on a different cache from the one used here. I can't see anything in code at present that looks obviously wrong, and in my tests there is only one query even for several messages. - Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:users-subscr...@qpid.apache.org - Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:users-subscr...@qpid.apache.org - Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:users-subscr...@qpid.apache.org
Re: Java API querying the exchange from which the message originated
On 09/04/2011 04:04 PM, Jakub Scholz wrote: Hi, I'm using a Java program in following scenario: 1) I have an topic exchange named X 2) I have queue named Y 3) I have a binding routing the messages from exchange X to queue Y 4) All objects - exchange, queue and binding - are predefined. They already exists when a Java client connects to the queue Y and tries to read a message from the queue. In general it works fine. But the other day I noticed, that the Java client, after picking up the message from the queue Y, sends and ExchangeQuery command for the exchange X to the AMQP broker. That seems strange to me, because I don't see any reason to do so ... Are you setting a reply-to address on the message being sent? If not, what addresses are you using (just the name of the exchange for producer and name of queue for consumer?) It is of course not a big issue, but: 1) It seems to be one unnecessary command for every received message (so it may have some performance impact) 2) The Java client needs to be allowed to query an exchange (in case strict ACL rules are used) Why does the Java client (Qpid 0.10) send this request? Is it an error or is it ok? Can it be swicthed off using some option? Thanks Regards Jakub - Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:users-subscr...@qpid.apache.org - Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:users-subscr...@qpid.apache.org
Re: Java API querying the exchange from which the message originated
Hi Gordon, The message has an ReplyTo property, but it points to another exchange, not to X. Also, the client sends the exchange query when only reading the messages, not when replying to them. The client does only this: ConnectionFactory fact = (ConnectionFactory) ctx.lookup(connection); Connectionconn; Session sess; conn = fact.createConnection(); sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); Destination requestDestination = (Destination) ctx.lookup(requestAddress); MessageConsumer requestConsumer; requestConsumer = sess.createConsumer(requestDestination); conn.start(); Message msg = requestConsumer.receive(10); where the destinations are following: java.naming.factory.initial = org.apache.qpid.jndi.PropertiesFileInitialContextFactory # connectionfactory.[jndiname] = [ConnectionURL] connectionfactory.connection = amqp://amqpsrv:amqpsrv@/?brokerlist='tcp://cbgd01:2' # destination.[jndiname] = [address_string] destination.requestAddress = Y; { node: { type: queue }, create: never, assert: never } The producer of the received message is using following destinations: destination.requestAddress = X; { node: { type: topic }, create: never } destination.replyAddress = U/routing_key_1; { create: never, node: { type: topic } } When the queue is empty, and the receive() call time-outs, then it doesn't send the exchange query. So it is clearly related to the received message. I believe the message contains some property describing the originating exchange. I assume the exchange query may be sent when parsing this property, since that is the only one linking to exchange X. Thanks Regards Jakub On Mon, Sep 5, 2011 at 09:50, Gordon Sim g...@redhat.com wrote: On 09/04/2011 04:04 PM, Jakub Scholz wrote: Hi, I'm using a Java program in following scenario: 1) I have an topic exchange named X 2) I have queue named Y 3) I have a binding routing the messages from exchange X to queue Y 4) All objects - exchange, queue and binding - are predefined. They already exists when a Java client connects to the queue Y and tries to read a message from the queue. In general it works fine. But the other day I noticed, that the Java client, after picking up the message from the queue Y, sends and ExchangeQuery command for the exchange X to the AMQP broker. That seems strange to me, because I don't see any reason to do so ... Are you setting a reply-to address on the message being sent? If not, what addresses are you using (just the name of the exchange for producer and name of queue for consumer?) It is of course not a big issue, but: 1) It seems to be one unnecessary command for every received message (so it may have some performance impact) 2) The Java client needs to be allowed to query an exchange (in case strict ACL rules are used) Why does the Java client (Qpid 0.10) send this request? Is it an error or is it ok? Can it be swicthed off using some option? Thanks Regards Jakub - Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:users-subscr...@qpid.apache.org - Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:users-subscr...@qpid.apache.org - Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:users-subscr...@qpid.apache.org
Re: Java API querying the exchange from which the message originated
On 09/05/2011 10:27 AM, Jakub Scholz wrote: I believe the message contains some property describing the originating exchange. I assume the exchange query may be sent when parsing this property, since that is the only one linking to exchange X. You are right. There is an exchange property in the headers and the library does use this to create a Destination object. To do that it needs to know the exchange type and issues a query if it does not. It does cache that information however, so should not query for every message (assuming the same exchange name). That doesn't match what you are seeing? What version of the client are you using? There was a similar sounding issue with reply-to, but that was based on a different cache from the one used here. I can't see anything in code at present that looks obviously wrong, and in my tests there is only one query even for several messages. - Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:users-subscr...@qpid.apache.org
Re: Java API querying the exchange from which the message originated
Hi Gordon, I'm using Qpid 0.10. But I checked it again and you are right, it really seems to send the exchange query only once - I probably saw some older exchange queries before. I'm sorry for the mystification. I assume doing it once should be acceptable and it is necessary evil to have the JMS Destination as the message property and not just the exchange name and routing key in a plain text. Thanks Regards Jakub On Mon, Sep 5, 2011 at 12:06, Gordon Sim g...@redhat.com wrote: On 09/05/2011 10:27 AM, Jakub Scholz wrote: I believe the message contains some property describing the originating exchange. I assume the exchange query may be sent when parsing this property, since that is the only one linking to exchange X. You are right. There is an exchange property in the headers and the library does use this to create a Destination object. To do that it needs to know the exchange type and issues a query if it does not. It does cache that information however, so should not query for every message (assuming the same exchange name). That doesn't match what you are seeing? What version of the client are you using? There was a similar sounding issue with reply-to, but that was based on a different cache from the one used here. I can't see anything in code at present that looks obviously wrong, and in my tests there is only one query even for several messages. - Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:users-subscr...@qpid.apache.org - Apache Qpid - AMQP Messaging Implementation Project: http://qpid.apache.org Use/Interact: mailto:users-subscr...@qpid.apache.org