Ejemplo n.º 1
0
 private void run() {
   try {
     Messenger mng = new MessengerImpl();
     mng.start();
     Message msg = new MessageImpl();
     msg.setAddress("amqp://*****:*****@0.0.0.0:5672/testq");
     msg.setPriority((short) 3);
     if (subject != null) msg.setSubject(subject);
     for (String body : bodies) {
       msg.setBody(new AmqpValue(body));
       mng.put(msg);
     }
     mng.send();
     mng.stop();
   } catch (Exception e) {
     tracer.log(Level.SEVERE, "proton error", e);
   }
 }
Ejemplo n.º 2
0
 public static void main(String[] args) {
   try {
     Messenger mng = Messenger.Factory.create();
     mng.start();
     Message msg = Message.Factory.create();
     msg.setAddress(address);
     if (subject != null) msg.setSubject(subject);
     for (String body : bodies) {
       msg.setBody(new AmqpValue(body));
       mng.put(msg);
     }
     log.info("Sending message ... ");
     mng.send();
     mng.stop();
     log.info("Done ...");
   } catch (Exception e) {
     log.log(Level.SEVERE, "proton error", e);
   }
 }