Package com.rabbitmq.client

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


      }
      if (routingKey == null) {
    System.err.println("Please supply routing key to send to (-k)");
    System.exit(2);
      }
      ch.exchangeDeclare(exchange, exchangeType);

      for (String filename : cmd.getArgs()) {
    System.out.print("Sending " + filename + "...");
    File f = new File(filename);
    FileInputStream i = new FileInputStream(f);
View Full Code Here


            Channel ch = conn.createChannel();

            if (exchange == null) {
                exchange = "amq.topic";
            } else {
                ch.exchangeDeclare(exchange, "topic");
            }

            System.out.println("Sending to exchange " + exchange + ", prefix: " + topicPrefix);

            int thisTimeCount = 0;
View Full Code Here

    public Producer createProducer(Connection connection, Stats stats, String id) throws IOException {
        Channel channel = connection.createChannel();
        if (producerTxSize > 0) channel.txSelect();
        if (confirm >= 0) channel.confirmSelect();
        if (!predeclared || !exchangeExists(connection, exchangeName)) {
            channel.exchangeDeclare(exchangeName, exchangeType);
        }
        final Producer producer = new Producer(channel, exchangeName, id,
                                               randomRoutingKey, flags, producerTxSize,
                                               producerRateLimit, producerMsgCount,
                                               minMsgSize, timeLimit,
View Full Code Here

    }

    public String configureQueue(Connection connection, String id) throws IOException {
        Channel channel = connection.createChannel();
        if (!predeclared || !exchangeExists(connection, exchangeName)) {
            channel.exchangeDeclare(exchangeName, exchangeType);
        }
        String qName = queueName;
        if (!predeclared || !queueExists(connection, queueName)) {
            qName = channel.queueDeclare(queueName,
                                         flags.contains("persistent"),
View Full Code Here

            final Channel channel = conn.createChannel();

            if (exchange == null) {
                exchange = "amq.topic";
            } else {
                channel.exchangeDeclare(exchange, "topic");
            }

            if (queue == null) {
                queue = channel.queueDeclare().getQueue();
            } else {
View Full Code Here

     *             if message is not published successfully for any reason
     */
    public void publishMessage(byte[] message, BasicProperties props)
            throws IOException {
        Channel channel = channel();
        channel.exchangeDeclare(exchange, "direct", true);
        channel.basicPublish(exchange, routingKey, props, message);
    }
}
View Full Code Here

    @Test
    public void shouldDeclareAndBindQueue() throws Exception {
        Channel channel = brokerSetup.getChannel();

        String routingKey = "test.key";
        channel.exchangeDeclare(TEST_EXCHANGE, "topic");
        brokerSetup.declareAndBindQueue(TEST_QUEUE, TEST_EXCHANGE, routingKey);
        channel.queueDeclarePassive(TEST_QUEUE);
       
        String body = "test.body";
        channel.basicPublish(TEST_EXCHANGE, routingKey, new BasicProperties(), body.getBytes());
View Full Code Here

      Channel channel = conn.createChannel();

      /**
       * make exchange and queue non-durable
       */
      channel.exchangeDeclare(exchangeName, "direct", true);
      if(!getQueue) {
         channel.queueDeclare(queueName, false, true, true, null);
      } else {
         queueName = channel.queueDeclare().getQueue();
      }
View Full Code Here

    {
        final Connection connection = m_connFactory.newConnection();
        final Channel channel = connection.createChannel();

        try {
            channel.exchangeDeclare("testExchange", "topic", true);
            String dataQueue = channel.queueDeclare().getQueue();
            channel.queueBind(dataQueue, "testExchange", "EXPORT_PARTITIONED_TABLE.#");
            channel.queueBind(dataQueue, "testExchange", "EXPORT_PARTITIONED_TABLE2.#");
            channel.queueBind(dataQueue, "testExchange", "EXPORT_REPLICATED_TABLE.#");
            String doneQueue = channel.queueDeclare().getQueue();
View Full Code Here

    ConnectionFactory factory = new ConnectionFactory();
    factory.setHost(mqServer);
    Connection connection = factory.newConnection();
    Channel channel = connection.createChannel();

    channel.exchangeDeclare(EXCHANGE_NAME, "topic");

    for (int i = 0; i < count; i++)
    {
      int rand = ((int) (Math.random() * 10000) % SetupConsumerCluster.DEFAULT_PARTITION_NUMBER);
      String routingKey = "topic_" + rand;
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.