1 package at.ac.tuwien.sbc.valesriegler.driver.jms;
3 import javax.jms.Connection;
4 import javax.jms.JMSException;
6 import org.apache.activemq.ActiveMQConnectionFactory;
7 import org.slf4j.Logger;
8 import org.slf4j.LoggerFactory;
10 import at.ac.tuwien.sbc.valesriegler.common.HasId;
13 * JMSDriver registers all the Listeners.
18 public class JMSDriver implements HasId {
19 private static final Logger log = LoggerFactory.getLogger(JMSDriver.class);
20 private final String CONNECTSTRING;
21 public String getCONNECTSTRING() {
27 public JMSDriver(String jmsURL, int id) {
28 CONNECTSTRING = jmsURL;
30 log.info("I AM A JMSCook WITH ID {}", this.id);
33 // Connecting to the Broker and to the output queue
34 ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(CONNECTSTRING);
35 Connection connection = connectionFactory.createConnection();
38 // Session sessWantToSit = connection.createSession(false,
39 // Session.CLIENT_ACKNOWLEDGE);
40 // MessageConsumer consWantToSit =
41 // sessWantToSit.createConsumer(sessWantToSit.createQueue("OrdersToCook"));
42 // consWantToSit.setMessageListener(new OrdersToCook(this));
43 } catch (JMSException e) {
44 log.error("EXCEPTION!", e);