qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF subversion and git services (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (QPIDJMS-332) Defining queue's name as tomcat resource conflichts resource definition
Date Tue, 03 Oct 2017 12:32:00 GMT

    [ https://issues.apache.org/jira/browse/QPIDJMS-332?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16189647#comment-16189647
] 

ASF subversion and git services commented on QPIDJMS-332:
---------------------------------------------------------

Commit 9692e6b42922c59f091724d8ae7814d9c5432b33 in qpid-jms's branch refs/heads/master from
[~gemmellr]
[ https://git-wip-us.apache.org/repos/asf?p=qpid-jms.git;h=9692e6b ]

QPIDJMS-332: change property used for JNDI storage of destination names

Stop using "name" to allow for Tomcat context.xml resource definition, where "name" is the
JNDI lookup. Use "address" going forward but continue to accept both, allowing other existing
configuration to still work.

Changes by myself and Tim.


> Defining queue's name as tomcat resource conflichts resource definition
> -----------------------------------------------------------------------
>
>                 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
>
> 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


Mime
View raw message