Package com.rabbitmq.client

Examples of com.rabbitmq.client.Channel.basicPublish()


        }
        else {
            throw new IllegalStateException("don't know how to transform " + contentType.getContentType());
        }

        channel.basicPublish(
            // exchange must default to non-null string
            message.getString("exchange", ""),
            message.getString("routingKey"),
            amqpPropsBuilder.build(),
            messageBodyBytes
View Full Code Here


        throws IOException,
          JSONException
    {
      final QueueMessage msg = this.get_message ();
      final Channel c = msg.get_channel ();
      c.basicPublish (msg.get_callback_exchange (), msg.get_callback_routing_key (), null, MessageHandler.encodeMessage (this.getOut ().array (), msg.get_callback_identifier ()));
    }
   
    volatile org.eclipse.jetty.io.Connection _jettyConnection;
    private QueueMessage _message;
  }
View Full Code Here

    {
      int rand = ((int) (Math.random() * 10000) % SetupConsumerCluster.DEFAULT_PARTITION_NUMBER);
      String routingKey = "topic_" + rand;
      String message = "message_" + rand;

      channel.basicPublish(EXCHANGE_NAME, routingKey, null, message.getBytes());
      System.out.println(" [x] Sent '" + routingKey + "':'" + message + "'");
     
      Thread.sleep(1000);
    }
   
View Full Code Here

        Connection conn = factory.newConnection();

        AMQP.BasicProperties.Builder properties = new AMQP.BasicProperties.Builder();

        Channel channel = conn.createChannel();
        channel.basicPublish(EXCHANGE, "", properties.build(), "hello world".getBytes());

        to.assertIsSatisfied();
    }
}
View Full Code Here

        if (channel == null) {
          throw new RuntimeException("Error creating a communication channel with RabbitMQ. Please verify the health of your RabbitMQ node and check your configuration.");
        }

        // Publish Message - to an exchange
        channel.basicPublish(this.exchangeName, this.routingKey, plugin.getBasicProperties(), this.getBytes());

        // Execution Time
        executionTime = new java.util.Date().getTime() - start;
        Logger.info("Message %s has been published to exchange %s with routing key %s (execution time: %s ms)", this.message, this.exchangeName , this.routingKey, executionTime);
View Full Code Here

        if (channel == null) {
          throw new RuntimeException("Error creating a communication channel with RabbitMQ. Please verify the health of your RabbitMQ node and check your configuration.");
        }

        // Publish Message
        channel.basicPublish(this.queueName, this.routingKey, plugin.getBasicProperties(), this.getBytes());

        // Execution Time
        executionTime = new java.util.Date().getTime() - start;
        Logger.info("Message %s has been published to queue %s (execution time: %s ms)", this.message, this.queueName, executionTime);
View Full Code Here

                    break;
                }

                Object next = events.remove(0);
                byte[] bytes = SerializerUtil.objectToByteArr(next);
                channel.basicPublish("", queueName, null, bytes);
                count++;
               
                log.info("Publishing message #" +count + ": " + next);
                Thread.sleep(msecSleepTime);
View Full Code Here

        final AmqpOutboundMessage message = (AmqpOutboundMessage) parameters[0];
        final String clientId = (String) parameters[1];
        final Channel channel = AmqpOperationFactory.this.amqpDriver.getChannel (clientId);
        if (channel != null) {
          final AMQP.BasicProperties properties = new AMQP.BasicProperties (message.getContentType (), message.getContentEncoding (), null, message.isDurable () ? 2 : 1, 0, message.getCorrelation (), message.getCallback (), null, message.getIdentifier (), null, null, null, null, null);
          channel.basicPublish (message.getExchange (), message.getRoutingKey (), properties, message.getData ());
          succeeded = true;
        }
        return succeeded;
      }
    });
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.