Hi Actually client is not using the server resource for 2 main reasons but you can define multiple client resources using the id instead of the qualified name IIRC. Reasons are:
- way to make it working would be to -- get a fully remote resource (would be slow and inefficient) -- guess what you need on client side (would never be adapted) -- allow you to define client resources on server side (what would be the point?) - each client can need a different config depending its needs and usage of the resource Romain Manni-Bucau @rmannibucau <https://twitter.com/rmannibucau> | Blog <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> | LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber <http://www.tomitribe.com> 2015-09-07 18:37 GMT-07:00 hkgot <[email protected]>: > Hi Romain, > > Finally, I got a chance to try this. The below code is working: > > System.setProperty("aConnectionFactory", > > "connectionfactory:org.apache.activemq.ActiveMQConnectionFactory:tcp://localhost:11616"); > System.setProperty("aQueue", > "queue:org.apache.activemq.command.ActiveMQQueue:LISTENER"); > final ConnectionFactory connectionFactory = (ConnectionFactory) > context.lookup("java:aConnectionFactory"); > > However, I am not sure whether this is creating a new connection factory or > referencing the connection factory from tomee.xml. Because what I > configured > in tomee.xml is MyJmsConnectionFactory, not connectionFactory. > > <Resource id="MyJmsConnectionFactory" type="javax.jms.ConnectionFactory"> > ResourceAdapter = MyJmsResourceAdapter > </Resource> > > In the sample you provided, aConnectionFactory is referencing > > connectionfactory:org.apache.activemq.ActiveMQConnectionFactory:tcp://localhost:11616, > not MyJmsConnectionFactory. How do I reference to MyJmsConnectionFactory? > > Thx. > > > > > > > > > > -- > View this message in context: > http://tomee-openejb.979440.n4.nabble.com/How-to-reference-connection-factory-and-queues-from-code-tp4675980p4676152.html > Sent from the TomEE Users mailing list archive at Nabble.com. >
