June 25, 2012

JMS Configuration in Spring's ApplicationContext


Recently I faced some issue to configure JMS queue in Spring's application context. This queue is exposed on Sonic ESB and I have to connect to it using Apache Camel. First I wrote 
a JMS Producer class which puts message on client's sonic JMS queue. It was something like this:
Hashtable properties = new Hashtable();

properties.put(Context.INITIAL_CONTEXT_FACTORY, "com.test.factory");
properties.put("com.domain", "DevelopmentDomain");
properties.put(Context.PROVIDER_URL, "tcp://10.00.0.00:0506");
properties.put(Context.SECURITY_PRINCIPAL, "aaa");
properties.put(Context.SECURITY_CREDENTIALS, "aaa");

javax.naming.Context context = new javax.naming.InitialContext(properties);
ConnectionFactory factory = (ConnectionFactory) context.lookup("ImpactPocQueueConnectionFactory");

Connection connection = factory.createConnection();

connection.start();

Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

Destination queue = session.createQueue("test.producer");
Now above JMS queue setup in applicationContext xml using Camel route.Here I am routing message to sonic queue through a seda queue.

     
          
             com.test.factory
             DevelopmentDomain
             tcp://10.00.0.00:0506
             aaa
             aaa
          
     


     
     

 
     



    
    

5 comments:

  1. I have read so many articles or reviews about the blogger
    lovers except this paragraph is in fact a good
    post, keep it up.

    Here is my web page voyance Gratuite

    ReplyDelete
  2. I'm trulу enјoying thе design аnd layout of your
    website. It's a very easy on the eyes ωhіch makess it much moгe enjoyable for me tо comе here and visit more oftеn.

    Dіd уou hіre out a developer to create your thеme?
    Fantastic ωork!

    my web page :: tarot gratuit

    ReplyDelete
  3. Thanks for your kind words! I am using one of the blogger theme.

    ReplyDelete
  4. whοah this weblog is wonderful i love stuԁying your articlеs.
    Stаy up the greаt wοгk! You recognіze, a lot of peoрlе are seaгсhing around for thiѕ
    infогmаtion, you could hеlp them greаtly.


    Look into mу page: vidente

    ReplyDelete