commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james_strac...@yahoo.co.uk>
Subject [messenger] patch for working with JBossMQ
Date Fri, 15 Feb 2002 11:14:35 GMT
From: "Saimon Moore" <saimonmoore@yahoo.co.uk>
> Well I've managed to patch the code up to work with
> JBossMQ.

Great! Thanks Saimon I'll apply these patches now.


> There were two problems:
>
> 1. When a ConnectionFactory is looked up in JBossNS,
> you get an org.jboss.mq.SpyConnectionFactory object
> returned which you have to cast to the appropriate
> object i.e. QueueConnectionFactory or
> TopicConnectionFactory. However, if you test the
> instance, both of the previous are valid.. i.e.
>
> <code>
> if (factory instanceof TopicConnectionFactory)
> </code>
>
> will return true even if factory has been previously
> cast to QueueConnectionFactory and vice-versa.
>
> There is a similar problem when creating the
> Connection. The jboss connection factory returns an
> org.jboss.mq.SpyConnection object that has to be cast
> to either QueueConnection or TopicConnection but
> checking the instance of the connection is not
> sufficient to diferentiate between the two.
>
> What I did to overcome this is re-implement both
> createConnection() and createSession() from
> SessionFactory in JNDISessionFactory relying on the
> lookup name, to differentiate and correctly create the
> appropriate factories,connections and sessions.

Maybe other providers might do this kinda thing, so maybe we should add a
boolean property to JNDISessionFactory so that it doesn't matter what the
name is in JNDI, we can coerce it into a Topic or Queue connection if the
object implements both interfaces.

e.g.

<jndi lookupName="TopicConnectionFactory" topic="true">
...


<jndi lookupName="QueueConnectionFactory" topic="false">
...

> Anyway, it's working fine now but I'm in the process
> of testing it out with other JMS providers e.g.
> AshnaMQ, and j2eesdk1.3 (By the way...what's the
> protocol used for this i.e. the provider url?)

The existing Messenger.xml in CVS should work fine for j2eesdk - though I
think the JNDI lookup name depends on if you are inside the j2ee server or
not. From memory I think its either TopicConnection (outside) or
java:env/TopicConnection (inside j2ee).

James



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message