1 package at.ac.tuwien.sbc.valesriegler;
3 import javax.jms.Connection;
4 import javax.jms.DeliveryMode;
5 import javax.jms.MessageProducer;
6 import javax.jms.Session;
8 import org.apache.activemq.ActiveMQConnectionFactory;
9 import org.slf4j.Logger;
10 import org.slf4j.LoggerFactory;
12 import at.ac.tuwien.sbc.valesriegler.types.PizzaType;
13 import at.ac.tuwien.sbc.valesriegler.types.Table;
15 public class DEBUG_CreateTable {
16 private static final Logger log = LoggerFactory.getLogger(DEBUG_CreateTable.class);
17 private static int nextID = 0;
20 public static void main(String[] args) throws Exception {
21 new DEBUG_CreateTable(++nextID);
24 public DEBUG_CreateTable(int id) {
26 log.info("I AM A DEBUG_CreateTable WITH ID {}", this.id);
27 produce(PizzaType.CARDINALE);
30 public void produce(PizzaType pizzatype) {
32 // Connecting to the Broker and to the output queue
33 ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616");
34 Connection connection = connectionFactory.createConnection();
36 Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
38 MessageProducer tableprod = session.createProducer(session.createQueue("TablesFree"));
39 tableprod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
42 for (int i = 0; i < 1; i++) {
43 tableprod.send(session.createObjectMessage(new Table(i)));
47 // for (int i = 0; i < 1; i++) {
48 // Group g = new Group();
51 // ArrayList<PizzaType> p = new ArrayList<PizzaType>();
52 // p.add(PizzaType.CARDINALE);
53 // p.add(PizzaType.MARGHERITA);
54 // p.add(PizzaType.SALAMI);
55 // p.add(PizzaType.MARGHERITA);
56 // Order o = new Order(p);
58 // g.goGrabSomeFood(); // start the workflow.
64 } catch (Exception e) {
65 log.error("Caught: ", e);