Created
November 18, 2012 18:09
-
-
Save bhdrkn/4106594 to your computer and use it in GitHub Desktop.
Broker ACtiveMQ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.bahadirakin.jms; | |
import org.apache.activemq.broker.BrokerService; | |
/** | |
* @author bahadir.akin | |
* | |
*/ | |
public class Broker { | |
public static void main(String[] args) { | |
BrokerService broker = new BrokerService(); | |
try { | |
broker.setPersistent(false); | |
broker.setUseJmx(false); | |
broker.setBrokerName("localhost"); | |
broker.addConnector("tcp://localhost:8182"); | |
broker.start(); | |
HelloWorldConsumer consumer = new HelloWorldConsumer(); | |
thread(consumer, false); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} | |
} | |
public static void thread(Runnable runnable, boolean daemon) { | |
Thread brokerThread = new Thread(runnable); | |
brokerThread.setDaemon(daemon); | |
brokerThread.start(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment