Skip to content
Snippets Groups Projects
Commit 85453d88 authored by Joel Cavat's avatar Joel Cavat
Browse files

Change Server name to Broker

parent adf17100
No related branches found
No related tags found
1 merge request!1Obj serialize
......@@ -39,12 +39,12 @@
<version>1.6.0</version>
<executions>
<execution>
<id>server</id>
<id>broker</id>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>ch.hepia.communication.Server</mainClass>
<mainClass>ch.hepia.communication.Broker</mainClass>
</configuration>
</execution>
<execution>
......
package ch.hepia.communication;
import javax.jms.Connection;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.BrokerService;
public class Server {
public Server(String ipBroker) {
try {
final String brokerUrl = "tcp://" + ipBroker + ":61616";
final BrokerService broker = new BrokerService();
broker.setPersistent(false);
broker.setUseJmx(false);
broker.addConnector(brokerUrl);
broker.start();
final ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(brokerUrl);
final Connection connection = connectionFactory.createConnection();
connection.start();
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
System.out.println(args[0]);
new Server( args.length == 1 ? args[0] : "localhost");
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment