You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by fadams <fr...@blueyonder.co.uk> on 2011/06/24 10:31:52 UTC

Is there any easy way for a client to detect which broker version it's connecting to?

As it says in the subject.

The reason why I'm asking is that there seems to be some differences in QMF
between 0.8 and 0.10 and it would be nice to program clients defensively.

Cheers,
Fraser.

--
View this message in context: http://apache-qpid-users.2158936.n2.nabble.com/Is-there-any-easy-way-for-a-client-to-detect-which-broker-version-it-s-connecting-to-tp6511290p6511290.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Is there any easy way for a client to detect which broker version it's connecting to?

Posted by fadams <fr...@blueyonder.co.uk>.
Aha I see what you mean now.

When I first started playing with this and I noticed the MapMessage vs
BytesMessage thing I tried looking at msg.getJMSType() to see if it said
"amqp/map" or "amqp/list", but it just seemed to return null....


Thanks for the QMF API vs protocol tip, that's a relief - I feel very zen
now :-) I'll get back to coding with confidence.



Gordon Sim wrote:
> 
> 
> Right, that's what I meant by the content type. The message is actually 
> annotated with either amqp/map or amqp/list which lets you determine how 
> to handle that. However in JMS you can't get that information and need 
> to resort to instanceof as you point out (which I agree is not ideal).
> 
> 


--
View this message in context: http://apache-qpid-users.2158936.n2.nabble.com/Is-there-any-easy-way-for-a-client-to-detect-which-broker-version-it-s-connecting-to-tp6511290p6512430.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Is there any easy way for a client to detect which broker version it's connecting to?

Posted by Gordon Sim <gs...@redhat.com>.
On 06/24/2011 04:05 PM, fadams wrote:
> Re: "Are there any other differences you have noted?"
>
> Well yeah :-) as we've previously discussed Event subscriptions appear to
> return MapMessages in 0.8 and BytesMessages (which need to be decoded into
> Lists as per your example) in 0.10
>
> clearly I can use instanceof to get the Message derived type, but I was
> curious about alternatives as I'm not fond of overusing instanceof.

Right, that's what I meant by the content type. The message is actually 
annotated with either amqp/map or amqp/list which lets you determine how 
to handle that. However in JMS you can't get that information and need 
to resort to instanceof as you point out (which I agree is not ideal).

> On a (QMF) related note I'm making real progress on my auditing client using
> the info you've previously supplied one thing is troubling me though. I
> noticed a post a couple of days ago on the subject of "Object IDs in QMF v2
> API". I've been using your example code to pull out queues/exchanges etc and
> I'm definitely seeing objectID (using ((Map)object.get("_object_id"));) but
> the API post seems to suggest "In the v2 API, the object ID is called
> DataAddr.  Refer to the hasAddr and getAddr methods in the Data class, "
> which don't look anything like I'm pulling out.

Ignore anything about the API. You are using the protocol directly.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Is there any easy way for a client to detect which broker version it's connecting to?

Posted by fadams <fr...@blueyonder.co.uk>.
Re: "Are there any other differences you have noted?"

Well yeah :-) as we've previously discussed Event subscriptions appear to
return MapMessages in 0.8 and BytesMessages (which need to be decoded into
Lists as per your example) in 0.10

clearly I can use instanceof to get the Message derived type, but I was
curious about alternatives as I'm not fond of overusing instanceof.


On a (QMF) related note I'm making real progress on my auditing client using
the info you've previously supplied one thing is troubling me though. I
noticed a post a couple of days ago on the subject of "Object IDs in QMF v2
API". I've been using your example code to pull out queues/exchanges etc and
I'm definitely seeing objectID (using ((Map)object.get("_object_id"));) but
the API post seems to suggest "In the v2 API, the object ID is called
DataAddr.  Refer to the hasAddr and getAddr methods in the Data class, "
which don't look anything like I'm pulling out.




Gordon Sim wrote:
> 
> 
> Really, there should not be changes that aren't backward compatible, 
> else the QMF messages themselves should provide sufficient context to 
> determine how to correctly interpret them.
> 
> The one difference I've seen is in the content-type. Unfortunately that 
> doesn't seem to be exposed through JMS(?). Are there any other 
> differences you have noted?
> 
> 


--
View this message in context: http://apache-qpid-users.2158936.n2.nabble.com/Is-there-any-easy-way-for-a-client-to-detect-which-broker-version-it-s-connecting-to-tp6511290p6512339.html
Sent from the Apache Qpid users mailing list archive at Nabble.com.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Is there any easy way for a client to detect which broker version it's connecting to?

Posted by Rajith Attapattu <ra...@gmail.com>.
On Fri, Jun 24, 2011 at 10:36 AM, Gordon Sim <gs...@redhat.com> wrote:
> On 06/24/2011 09:31 AM, fadams wrote:
>>
>> As it says in the subject.
>>
>> The reason why I'm asking is that there seems to be some differences in
>> QMF
>> between 0.8 and 0.10 and it would be nice to program clients defensively.
>
> Really, there should not be changes that aren't backward compatible, else
> the QMF messages themselves should provide sufficient context to determine
> how to correctly interpret them.
>
> The one difference I've seen is in the content-type. Unfortunately that
> doesn't seem to be exposed through JMS(?). Are there any other differences
> you have noted?

JMS doesn't really have a getContentType method.
Perhaps we can expose that through "qpid.content-type" and that could help here.

Rajith

>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
>
>

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Is there any easy way for a client to detect which broker version it's connecting to?

Posted by Gordon Sim <gs...@redhat.com>.
On 06/24/2011 09:31 AM, fadams wrote:
> As it says in the subject.
>
> The reason why I'm asking is that there seems to be some differences in QMF
> between 0.8 and 0.10 and it would be nice to program clients defensively.

Really, there should not be changes that aren't backward compatible, 
else the QMF messages themselves should provide sufficient context to 
determine how to correctly interpret them.

The one difference I've seen is in the content-type. Unfortunately that 
doesn't seem to be exposed through JMS(?). Are there any other 
differences you have noted?


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Is there any easy way for a client to detect which broker version it's connecting to?

Posted by Rajith Attapattu <ra...@gmail.com>.
Fraser,

In JMS there is the meta data properties in the Connection object.
So I guess we should be able to leverage that, atleast using a custom property.

For the following methods, we return the AMQP protocol version.
con.getMetaData().getProviderMajorVersion()
con.getMetaData().getProviderMinorVersion()

Perhaps what's appropriate here is to report the broker's release
version and then the AMQP version could be a  JMSX custom property.

For con.getMetaData().getProviderVersion() we return (for the C++ broker)
Version qpid (Client: [exported] ; Broker [<unkown>] ; Protocol: [ 0-10] )
I think it's meant to report the client and broker release versions.

If the brokers can send the release version as a connection property
we should be able to expose them as either the provider version or via
a custom JMSX prop.

Could you open a JIRA with your requirement? I can follow up and post
a patch and see if I can get it in time for 0-12.

Regards,

Rajith


On Fri, Jun 24, 2011 at 4:31 AM, fadams <fr...@blueyonder.co.uk> wrote:
> As it says in the subject.
>
> The reason why I'm asking is that there seems to be some differences in QMF
> between 0.8 and 0.10 and it would be nice to program clients defensively.
>
> Cheers,
> Fraser.
>
> --
> View this message in context: http://apache-qpid-users.2158936.n2.nabble.com/Is-there-any-easy-way-for-a-client-to-detect-which-broker-version-it-s-connecting-to-tp6511290p6511290.html
> Sent from the Apache Qpid users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
>
>

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org