RE: IS it possible to avoid JNDI call to get context for ConnectionFactory

"Tim Anderson" <[email protected]>
Newsgroups gmane.comp.java.openjms.user
Message-ID <005501c53c52$46a23eb0$0100000a@xerces>
The lookup refers to a JNDI lookup. E.g:
    Hashtable properties = new Hashtable();
    properties.put(Context.INITIAL_CONTEXT_FACTORY, 
                   "org.exolab.jms.jndi.InitialContextFactory");
    properties.put(Context.PROVIDER_URL, "rmi://localhost:1099/");
    Context context = new InitialContext(properties);

    QueueConnectionFactory factory = 
      (QueueConnectionFactory) context.lookup("JmsQueueConnectionFactory");

To construct a connection factory directly,  you need to construct a
org.exolab.jms.client.JmsQueueConnectionFactory 
or org.exolab.jms.client.JmsTopicConnectionFactory, with the appropriate
connector parameters. In order to determine the connector parameters,
you'll have to examine the openjms source, as described previously.

-Tim


> From: Sale Rahul
> Sent: Friday, 8 April 2005 12:57 AM
> 
> 
> Hello Tim,
> Thanks a lot for this, I really meant how do I get
> connection factory directly.
> When you said "Lookup the connection factory" - what
> does that means.. I could not understand it. 
> Please, can you give me more details abt the same.
> 
> 
> --- Tim Anderson <[email protected]> wrote:
> 
> > Not sure what you mean - looked through many
> > examples
> > and couldn't find a way to use JNDI, or couldn't
> > find
> > a way to construct a connection factory directly?
> > 
> > If the former, there are examples in
> > src/examples/openjms/examples/client/console/ in the
> > distribution.
> > 
> > If the latter, there a no examples of ways to
> > construct
> > a connection factory directly, because that is not
> > the
> > recommended way to do it.
> > That said, if you really need to do it, you can
> > either:
> > 1. lookup the connection factory object, and
> > serialize to file
> >    Clients can then deserialize the connection
> > factory
> >    from the file and use it to connect to the
> > server.
> >   
> > 2. Construct an instance of
> > JmsQueueConnectionFactory,
> >    or JmsTopicConnectionFactory directly
> >    You'll need to look at the sources to determine
> >    what parameters need to be passed. This is
> >    dependent on the type of connector you are using.
> >    For tcp, see:
> >     
> >
> org.exolab.jms.server.mipc.IpcJmsServer.bindConnectionFactories()
> >    For rmi, see:
> >     
> >
> org.exolab.jms.server.rmi.RmiJmsServer.bindConnectionFactories()
> > 
> > However the above approaches won't work in the next
> > major release
> > of OpenJMS, as the connection factories have
> > changed.
> > The portable solution across OpenJMS versions is to
> > use JNDI.
> > 
> > -Tim
> > 
> > 
> > 
> > > From: openjms-user-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> > > [mailto:openjms-user-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org]
> > On Behalf
> > > Of Sale Rahul
> > > Sent: Tuesday, 5 April 2005 4:51 AM
> > > To: [email protected]
> > > Subject: RE: [openjms-user] IS it possible to
> > avoid JNDI call
> > > to get context for ConnectionFactory
> > > 
> > > 
> > > Hello Tim,
> > > Thanks a lot for quick reply.
> > > It will be of great help you some one can tell me
> > how
> > > do we do it. I looked thru many examples but could
> > not
> > > find the correct way to do it ???
> > > 
> > > 
> > > Thanks.....
> > > 
> > > 
> > > With Regs
> > > Rahul
> > > --- Tim Anderson <[email protected]> wrote:
> > > > Any reason why not?
> > > > The preferred method is connecting via JNDI.
> > > > While you could construct the connection
> > factories
> > > > directly,
> > > > but there is no guarantee that this will work
> > across
> > > > 
> > > > OpenJMS releases.
> > > > 
> > > > -Tim
> > > > 
> > > > > Sale Rahul
> > > > > 
> > > > > Hello All,
> > > > > We dnt want to use JNDI while connecting to
> > the
> > > > > openjms server Is thre any way to do that ??
> > > > > 
> > > > > 
> > > > > Thanks a lot
> > > > > 
> > > > > 
> > > > > With Regs
> > > > > RAhul Saley
> > > > > 
> > > > 
> > > > 
> > > > 
> > > >
> > >
> >
> -------------------------------------------------------
> > > > SF email is sponsored by - The IT Product Guide
> > > > Read honest & candid reviews on hundreds of IT
> > > > Products from real users.
> > > > Discover which products truly live up to the
> > hype.
> > > > Start reading now.
> > > >
> > >
> >
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> > > > _______________________________________________
> > > > openjms-user mailing list [email protected]
> > > >
> > >
> >
> https://lists.sourceforge.net/lists/listinfo/openjms-user
> > > > 
> > > 
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Tired of spam?  Yahoo! Mail has the best spam
> > protection around
> > > http://mail.yahoo.com
> > > 
> > > 
> > >
> >
> -------------------------------------------------------
> > > SF email is sponsored by - The IT Product Guide
> > > Read honest & candid reviews on hundreds of IT
> > Products from
> > > real users. Discover which products truly live up
> > to the
> > > hype. Start reading now.
> > >
> >
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> > > _______________________________________________
> > > openjms-user mailing list [email protected]
> > >
> >
> https://lists.sourceforge.net/lists/listinfo/openjms-user
> > > 
> > 
> > 
> > 
> >
> -------------------------------------------------------
> > SF email is sponsored by - The IT Product Guide
> > Read honest & candid reviews on hundreds of IT
> > Products from real users.
> > Discover which products truly live up to the hype.
> > Start reading now.
> >
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> > _______________________________________________
> > openjms-user mailing list
> > [email protected]
> >
> https://lists.sourceforge.net/lists/listinfo/openjms-user
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
> 
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from 
> real users. Discover which products truly live up to the 
> hype. Start reading now. 
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> openjms-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/openjms-user
> 



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.