Package com.drighetto.essai.springactivemq

Source Code of com.drighetto.essai.springactivemq.SampleUsingTopic

package com.drighetto.essai.springactivemq;

import com.drighetto.essai.springactivemq.processor.MyMessageProducer;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
* Example using TOPIC
*
* @author Dominique RIGHETTO<br>
*         29 nov. 07<br>
*/
public class SampleUsingTopic {

  /**
   * Entry point
   *
   * @author Dominique RIGHETTO<br>
   *         29 nov. 07<br>
   * @param args
   *            Command line
   */
  public static void main(String[] args) {
    try {
      // Create spring context
      ApplicationContext appCtx = new ClassPathXmlApplicationContext(
          "applicationContext-Topic.xml");

      // Get JMS template for message sending
      MyMessageProducer myMessageProducer = (MyMessageProducer) appCtx
          .getBean("myMessageProducer");

      // Processing send/receive
      while (true) {
        myMessageProducer.sendMessage("Hello World "
            + System.currentTimeMillis());
        Thread.sleep(2000);
      }
    } catch (Exception e) {
      e.printStackTrace();
    }

  }

}
TOP

Related Classes of com.drighetto.essai.springactivemq.SampleUsingTopic

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.