JMS plugin

View: New views
5 Messages — Rating Filter:   Alert me  

JMS plugin

by Huang, Thomas (388J) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi

I am new to Grails and my first task is to implement a JMS message  
listener on an existing JMS topic.  I am using JBoss MQ and I have the  
following defined in my resources.xml

    <bean id="connectionFactory"  
class="org.springframework.jndi.JndiObjectFactoryBean">
       <property name="jndiName" value="UIL2ConnectionFactory" />
       <property name="jndiEnvironment">
          <props>
             <prop  
key
=
"java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</
prop>
             <prop key="java.naming.provider.url">localhost:1099</prop>
          </props>
       </property>
    </bean>


And I modified the SampleQueueService.groovy to listen to my topic

class SampleQueueService {

    static expose = ['jms']
    static pubSub = true
    static durable = true
    static topic = 'my/msg/topic'

    def onMessage = {
       println "GOT MESSAGE: $it"
    }

}

At this point my service is not picking up any messages.  I have a  
couple of questions

1. where do I specify user credential information to connect to the JMS?
2. if I want to do something with the message and than republish it a  
different topic, how do I do that?


please advise,

Thomas.

------------------------------------------------------------------
Thomas Huang
Jet Propulsion Laboratory
4800 Oak Grove Drive, Mail Stop 171-243D, Pasadena, CA 91109
Phone: 818.354.2747, Email: thomas.huang@...

DISCLAIMER: All personal and professional opinions presented herein  
are my own and do not, in any way, represent the opinion of policy of  
JPL, NASA or Caltech.





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: JMS plugin

by englishteeth :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thomas Huang wrote:
And I modified the SampleQueueService.groovy to listen to my topic

class SampleQueueService {

    static expose = ['jms']
    static pubSub = true
    static durable = true
    static topic = 'my/msg/topic'

    def onMessage = {
       println "GOT MESSAGE: $it"
    }

}

At this point my service is not picking up any messages.  I have a  
couple of questions

1. where do I specify user credential information to connect to the JMS?
2. if I want to do something with the message and than republish it a  
different topic, how do I do that?
Hi Thomas,

To get your service to pick up, you need to set a static destination rather than topic to specify something other than the default of the service name "sampleQueue" being used.

Credentials would go in the set up of the connection factory.

If I understand you right, to republish your message from your service should be very similar to how you are sending now; get the conection factory, and use a jms template to send, just in your service's onMessage.

I added an update to my original post on this for pub sub here . Thanks for sparking my interest.


Ian

Re: JMS plugin

by Graeme Rocher-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Jun 27, 2008 at 11:11 AM, englishteeth <englishteeth@...> wrote:

>
>
> Thomas Huang wrote:
>>
>> And I modified the SampleQueueService.groovy to listen to my topic
>>
>> class SampleQueueService {
>>
>>     static expose = ['jms']
>>     static pubSub = true
>>     static durable = true
>>     static topic = 'my/msg/topic'
>>
>>     def onMessage = {
>>        println "GOT MESSAGE: $it"
>>     }
>>
>> }
>>
>> At this point my service is not picking up any messages.  I have a
>> couple of questions
>>
>> 1. where do I specify user credential information to connect to the JMS?
>> 2. if I want to do something with the message and than republish it a
>> different topic, how do I do that?
>>
>
> Hi Thomas,
>
> To get your service to pick up, you need to set a static destination rather
> than topic to specify something other than the default of the service name
> "sampleQueue" being used.
>
> Credentials would go in the set up of the connection factory.
>
> If I understand you right, to republish your message from your service
> should be very similar to how you are sending now; get the conection
> factory, and use a jms template to send, just in your service's onMessage.
>
> I added an update to my
> http://www.englishteeth.co.uk/2008/04/18/grails-jms-mdb/ original post  on
> this for pub sub
> http://www.englishteeth.co.uk/2008/06/26/grails-jms-revisited/ here  .
> Thanks for sparking my interest. =)

Nice posts Ian, you should add your blog to groovyblogs.org

Cheers

>
>
> Ian
> --
> View this message in context: http://www.nabble.com/JMS-plugin-tp18119291p18152015.html
> Sent from the grails - user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>



--
Graeme Rocher
Grails Project Lead
G2One, Inc. Chief Technology Officer
http://www.g2one.com

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: JMS plugin

by Huang, Thomas (388J) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Ian.  Do you have example on configuring the connection factory  
with user credential for topic connection?  I found example on secure  
credential for connecting with JNDI for lookup, but I can't seem to  
find anything with making connection to a JMS topic that requires user  
authentication.

thanks again,

Thomas.

On Jun 27, 2008, at 3:11 AM, englishteeth wrote:

>
>
> Thomas Huang wrote:
>>
>> And I modified the SampleQueueService.groovy to listen to my topic
>>
>> class SampleQueueService {
>>
>>    static expose = ['jms']
>>    static pubSub = true
>>    static durable = true
>>    static topic = 'my/msg/topic'
>>
>>    def onMessage = {
>>       println "GOT MESSAGE: $it"
>>    }
>>
>> }
>>
>> At this point my service is not picking up any messages.  I have a
>> couple of questions
>>
>> 1. where do I specify user credential information to connect to the  
>> JMS?
>> 2. if I want to do something with the message and than republish it a
>> different topic, how do I do that?
>>
>
> Hi Thomas,
>
> To get your service to pick up, you need to set a static destination  
> rather
> than topic to specify something other than the default of the  
> service name
> "sampleQueue" being used.
>
> Credentials would go in the set up of the connection factory.
>
> If I understand you right, to republish your message from your service
> should be very similar to how you are sending now; get the conection
> factory, and use a jms template to send, just in your service's  
> onMessage.
>
> I added an update to my
> http://www.englishteeth.co.uk/2008/04/18/grails-jms-mdb/ original  
> post  on
> this for pub sub
> http://www.englishteeth.co.uk/2008/06/26/grails-jms-revisited/ here  .
> Thanks for sparking my interest. =)
>
>
> Ian
> --
> View this message in context: http://www.nabble.com/JMS-plugin-tp18119291p18152015.html
> Sent from the grails - user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>

------------------------------------------------------------------
Thomas Huang
Jet Propulsion Laboratory
4800 Oak Grove Drive, Mail Stop 171-243D, Pasadena, CA 91109
Phone: 818.354.2747, Email: thomas.huang@...

DISCLAIMER: All personal and professional opinions presented herein  
are my own and do not, in any way, represent the opinion of policy of  
JPL, NASA or Caltech.





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: JMS plugin

by Huang, Thomas (388J) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

After some more research I now have something working for making topic connection (to JBossMQ)  that requires authentication.  Here is resources.xml file

<?xml version="1.0" encoding="UTF-8"?>

    <bean id="globalConnectionFactory"
        class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiName" value="TopicConnectionFactory" />
        <property name="jndiEnvironment">
            <props>
                <prop key="java.naming.provider.url"
                    >jnp://localhost:1099</prop>
                <prop key="java.naming.factory.initial"
                    >org.jnp.interfaces.NamingContextFactory</prop>
                <prop key="java.naming.factory.url.pkgs"
                    >org.jboss.naming:org.jnp.interfaces</prop>
            </props>
        </property>
    </bean>

    <bean id="connectionFactory"
        class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
        <property name="targetConnectionFactory">
            <ref bean="globalConnectionFactory" />
        </property>
        <property name="username" value="username" />
        <property name="password" value="password" />
    </bean>

</beans>


Thomas.

On Jun 27, 2008, at 3:11 AM, englishteeth wrote:



Thomas Huang wrote:

And I modified the SampleQueueService.groovy to listen to my topic

class SampleQueueService {

   static expose = ['jms']
   static pubSub = true
   static durable = true
   static topic = 'my/msg/topic'

   def onMessage = {
      println "GOT MESSAGE: $it"
   }

}

At this point my service is not picking up any messages.  I have a  
couple of questions

1. where do I specify user credential information to connect to the JMS?
2. if I want to do something with the message and than republish it a  
different topic, how do I do that?


Hi Thomas,

To get your service to pick up, you need to set a static destination rather
than topic to specify something other than the default of the service name
"sampleQueue" being used.

Credentials would go in the set up of the connection factory.

If I understand you right, to republish your message from your service
should be very similar to how you are sending now; get the conection
factory, and use a jms template to send, just in your service's onMessage.

I added an update to my
http://www.englishteeth.co.uk/2008/04/18/grails-jms-mdb/ original post  on
this for pub sub
http://www.englishteeth.co.uk/2008/06/26/grails-jms-revisited/ here  .
Thanks for sparking my interest. =)


Ian
--
View this message in context: http://www.nabble.com/JMS-plugin-tp18119291p18152015.html
Sent from the grails - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



------------------------------------------------------------------
Thomas Huang
Jet Propulsion Laboratory
4800 Oak Grove Drive, Mail Stop 171-243D, Pasadena, CA 91109
Phone: 818.354.2747, Email: thomas.huang@...

DISCLAIMER: All personal and professional opinions presented herein are my own and do not, in any way, represent the opinion of policy of JPL, NASA or Caltech.