Beispiel #1
0
 public void send(
     RouteSpec routeSpec, String routingKey, AMQP.BasicProperties properties, Object payload)
     throws IOException {
   Route route = routeSpec.declareOn(channel, this);
   route.publishOn(
       channel, routingKey, properties, toBytes(MediaTypes.valueOf(properties), payload));
 }
Beispiel #2
0
  private void declareConsumers() throws IOException {
    for (final EndPointMethod endPointMethod : endPointMethods) {
      final RouteSpec routeSpec = endPointMethod.getRouteIn();
      Route route = routeSpec.declareOn(channel, this);

      log.debug("consuming on " + route.getQueue() + " ==> " + endPointMethod);

      boolean autoAck = false;
      channel.basicConsume(
          route.getQueue(),
          autoAck,
          endPointMethod.toString(),
          new DefaultConsumer(channel) {
            @Override
            public void handleDelivery(
                String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body)
                throws IOException {
              String routingKey = envelope.getRoutingKey();
              String contentType = properties.getContentType();
              long deliveryTag = envelope.getDeliveryTag();

              endPointMethod.call(new Event(Qarrot.this, channel, envelope, properties, body));
            }
          });
    }
  }
Beispiel #3
0
 public void declare(RouteSpec routeSpec) throws IOException {
   routeSpec.declareOn(channel, this);
 }