Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package activemq.test;
- import java.util.HashMap;
- import java.util.HashSet;
- import java.util.Map;
- import org.apache.activemq.api.core.TransportConfiguration;
- import org.apache.activemq.core.config.Configuration;
- import org.apache.activemq.core.config.impl.ConfigurationImpl;
- import org.apache.activemq.core.remoting.impl.netty.NettyAcceptorFactory;
- import org.apache.activemq.core.server.ActiveMQServer;
- import org.apache.activemq.core.server.ActiveMQServers;
- public class Server {
- public static void main(final String arg[]) throws Exception
- {
- try
- {
- // Step 1. Create the Configuration, and set the properties accordingly
- Configuration configuration = new ConfigurationImpl();
- //we only need this for the server lock file
- configuration.setJournalDirectory("target/data/journal");
- configuration.setPersistenceEnabled(false);
- configuration.setSecurityEnabled(false); // http://activemq.apache.org/security.html
- /**
- * this map with configuration values is not necessary (it configures the default values).
- * If you want to modify it to run the example in two different hosts, remember to also
- * modify the client's Connector at {@link EmbeddedRemoteExample}.
- */
- Map<String, Object> map = new HashMap<String, Object>();
- map.put("host", "localhost");
- map.put("port", 61616);
- TransportConfiguration transpConf = new TransportConfiguration(NettyAcceptorFactory.class.getName(),map);
- HashSet<TransportConfiguration> setTransp = new HashSet<TransportConfiguration>();
- setTransp.add(transpConf);
- configuration.setAcceptorConfigurations(setTransp);
- // Step 2. Create and start the server
- ActiveMQServer server = ActiveMQServers.newActiveMQServer(configuration);
- server.start();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- throw e;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment