You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Robbie Gemmell (JIRA)" <ji...@apache.org> on 2017/10/03 12:47:00 UTC

[jira] [Updated] (QPIDJMS-332) enable defining destination names in tomcat resource definitions

     [ https://issues.apache.org/jira/browse/QPIDJMS-332?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robbie Gemmell updated QPIDJMS-332:
-----------------------------------
    Summary: enable defining destination names in tomcat resource definitions  (was: Defining queue's name as tomcat resource conflichts resource definition)

> enable defining destination names in tomcat resource definitions
> ----------------------------------------------------------------
>
>                 Key: QPIDJMS-332
>                 URL: https://issues.apache.org/jira/browse/QPIDJMS-332
>             Project: Qpid JMS
>          Issue Type: Improvement
>          Components: qpid-jms-client
>    Affects Versions: 0.25.0
>            Reporter: Bernhard Seidl
>            Assignee: Robbie Gemmell
>             Fix For: 0.26.0
>
>
> Since a few days i am trying to define a queue resource in Tomcat's context.xml. The attribute "name" defines the jndi name. Looking at org.apache.qpid.jms.JmsDestination 
> the attribute is called "name", too. This seems to me as a  naming conflict. I tried to use  the attribute "physicalName" due to the fact that some of the classes are based on ActiveMQ. However I am not sure if I am missing a point somewhere else:
> This is my setup:
> Context.xml
> {code:xml}
> <Resource name="jms/ConnectionFactory" auth="Container"
> 		type="org.apache.qpid.jms.JmsConnectionFactory" factory="org.apache.qpid.jms.jndi.JNDIReferenceFactory"
> 		remoteURI="amqp://10.10.10.1:5672" username="a" password="a"
> 		maxPoolSize="20" connectionTimeout="60000" />
> 	<Resource name="jms/queue" auth="Container"
> 		type="org.apache.qpid.jms.JmsQueue" factory="org.apache.qpid.jms.jndi.JNDIReferenceFactory"
> 		physicalName="name"/>
> {code}
> Init-code using spring:
> {code:java}
> @Configuration
> @EnableJms
> public class MessagingConfiguration {
> 	@Bean
> 	public ConnectionFactory connectionFactory() throws NamingException {
> 		ConnectionFactory connectionFactory =  (new JndiTemplate())
> 				.lookup("java:/comp/env/jms/ConnectionFactory",ConnectionFactory.class);
> 		return connectionFactory;
> 	}
> 	
> 	@Bean
> 	public DestinationResolver destinationResolver() {
> 		JndiDestinationResolver jdr = new JndiDestinationResolver();
> 		try {
> 			// testing
> 			Queue q = jdr.getJndiTemplate().lookup("java:/comp/env/jms/queue", Queue.class);
> 			System.out.println("A: " + q.getQueueName());
> 			System.out.println("B: " + (new JndiTemplate()).lookup("java:/comp/env/jms/queue", Destination.class).getClass());
> 		} catch (Exception e) {
> 			// TODO Auto-generated catch block
> 			e.printStackTrace();
> 		}
> 		return jdr; 
> 	}
> 	@Bean
> 	public JmsTemplate jmsTemplate() throws NamingException {
> 		JmsTemplate template = new JmsTemplate();
> 		template.setConnectionFactory(connectionFactory());
> 		template.setDestinationResolver(destinationResolver());
> 		return template;
> 	}
> }
> {code}
> Running the code prints out:
> {noformat}
> ...
> A:
> B: class org.apache.qpid.jms.JmsQueue
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org