On Dec 6, 2007 10:46 AM, jeff1331 <[EMAIL PROTECTED]> wrote:
>
> Ok, I've given this a whirl for a few days, would appreciate some help. We
> have a JMS topic publishing events and I want to connect to it via service
> mix. I've been attempting to use the servicemix-jms component.
>
> I've worked through most of the issues but there is one hurdle I can't seem
> to get over. The topic requires a username and password when the connection
> is created. In code, it looks like this:
>
> /*********** java code
> TopicConnectionFactory factory = (TopicConnectionFactory)
> ctx.lookup("ConnectionFactory");
> Topic eventTopic = (Topic) ctx.lookup(topicName);
> System.out.println("Found JMS topic.");
>
> TopicConnection topicConnection = factory.createTopicConnection("xyzUser",
> "xyzPass");
>
> TopicSession topicSession = topicConnection.createTopicSession(false,
> Session.AUTO_ACKNOWLEDGE);
> TopicSubscriber topicSubscriber = topicSession.createSubscriber(eventTopic);
> System.out.println("Connected to topic.");
> topicSubscriber.setMessageListener(this);
> ********** end java code */
>
> Notice the factory.createTopicConnection() method taking the username and
> password.
>
> In my xbean.xml configuration for the jms component, I have the following:
> (the xyJndiTemplate is a customer class that will not only set JNDI
> properties but some system properties required for the JMS connection -
> right now, values are hardcoded)
> /********** xbean config
> <beans xmlns:jms="http://servicemix.apache.org/jms/1.0";
>        xmlns:b="http://servicemix.apache.org/samples/vc1";>
>
> <classpath>
>         <location>lib/jbossall-client-4.0.2.GA.jar</location>
>         <location>lib/xy-common-1.0-SNAPSHOT.jar</location>
> </classpath>
>
> <jms:endpoint service="b:MyConsumerService"
>               endpoint="jms"
>               targetService="b:pipeline"
>               targetEndpoint="myConsumer"
>               role="consumer"
>               destinationStyle="topic"
>
> initialContextFactory="org.jboss.naming.HttpNamingContextFactory"
>               jndiProviderURL="http://192.168.5.5:8881/invoker/JNDIFactory";
>               jndiDestinationName="topic/MyTopicName"
>               jndiConnectionFactoryName="ConnectionFactory"
>               defaultMep="http://www.w3.org/2004/08/wsdl/in-out";
>               defaultOperation="test:Echo"
>               needJavaIdentifiers="false" />
>
>
>
> <bean id="props" autowire="no"
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
>                 <property name="location" 
> value="C:\temp\xy_launch.properties"/>
>                 <property name="systemPropertiesModeName"
> value="SYSTEM_PROPERTIES_MODE_OVERRIDE"/>
>         </bean>
>
>    <bean id="xyJndiTemplate" class="com.xy.common.util.JndiTemplate">
>
>                 <constructor-arg>
>                         <props>
>                                 <prop
> key="java.naming.factory.initial">org.jboss.naming.HttpNamingContextFactory</prop>
>                                 <prop
> key="java.naming.provider.url">http://192.168.5.5:8881/invoker/JNDIFactory</prop>
>                                 <prop
> key="java.naming.factory.url.pkgs">org.jboss.naming:org.jnp.interfaces</prop>
>                         </props>
>                 </constructor-arg>
>                 <property name="systemProperties">
>                         <props>
>                                 <prop
> key="xy.ejb_invoker_servlet_path">http://192.168.5.5:8881/invoker/EJBInvokerServlet</prop>
>                                 <prop
> key="xy.jmx_invoker_servlet_path">http://192.168.5.5:8881/invoker/JMXInvokerServlet</prop>
>                                 <prop
> key="java.security.auth.login.config">C:\temp\jms_test\auth.conf</prop>
>                         </props>
>                 </property>
>         </bean>
> ***************** end xbean config ***********/
>
> The problem is that there doesn't seem to be anywhere to specify the
> username and password used when the connection is created as there is in
> code. So I tried somewhat desperately to use the connection factory from
> ActiveMQ and set the connection factory in the jms component to use it
> (using the #connectionFactory as the value)
>
>   <bean id="connectionFactory"
> class="org.apache.activemq.ActiveMQConnectionFactory">
>     <property name="brokerURL" value="tcp://localhost:61616" />
>     <property name="userName" value="xyUser" />
>     <property name="password" value="xyPass" />
>   </bean>
>
> But that just seemed give me a local connection out of the pool, which isn't
> what I needed. I needed to get a connection from the factory on the other
> JMS server.

What you've done above to specify the username/password on the
connectionFactory is correct, but I'm not sure what you mean be 'the
other JMS server'? Is there more than one ActiveMQ broker being used?
Please clarify this further.

Bruce
-- 
perl -e 'print unpack("u30","D0G)[EMAIL 
PROTECTED]&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache Camel - http://activemq.org/camel/
Apache ServiceMix - http://servicemix.org/
Apache Geronimo - http://geronimo.apache.org/

Blog: http://bruceblog.org/

Reply via email to