Examples of basicPublish()


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

    factory.setHost("localhost");
    Connection connection = factory.newConnection();
    Channel channel = connection.createChannel();
    channel.exchangeDeclare(EXCHANGE_NAME, "fanout");
    String message = getMessage(argv);
    channel.basicPublish(EXCHANGE_NAME, "", null, message.getBytes());
    System.out.println(" [x] Sent '" + message + "'");
    channel.close();
    connection.close();
  }
View Full Code Here

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

      connection = factory.newConnection();
      channel = connection.createChannel();
      channel.exchangeDeclare(EXCHANGE_NAME, "topic");
      String routingKey = getRouting(argv);
      String message = getMessage(argv);
      channel.basicPublish(EXCHANGE_NAME, routingKey, null,
          message.getBytes());
      System.out.println(" [x] Sent '" + routingKey + "':'" + message
          + "'");
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

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

    factory.setHost("localhost");
    Connection connection = factory.newConnection();
    Channel channel = connection.createChannel();
    channel.queueDeclare(QUEUE_NAME, false, false, false, null);
    String message = "Hello World!";
    channel.basicPublish("", QUEUE_NAME, null, message.getBytes());
    System.out.println(" [x] Sent '" + message + "'");
    channel.close();
    connection.close();
  }
}
View Full Code Here

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

        AMQP.BasicProperties.Builder properties = new AMQP.BasicProperties.Builder();
        properties.replyTo("myReply");

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

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

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

      String gender = r.nextBoolean() ? "male" : "female";
      int age = 20 + r.nextInt(70);

      String line = String.format(msg_template, sdf.format(timer.getTime()), wp, gender, age);

      channel.basicPublish(exchange, routingKey, null, line.getBytes());

      System.out.println("Sent message: " + line);

      timer.add(Calendar.SECOND, interval);
View Full Code Here

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

            @Override
            public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
                throw new RuntimeException("oops");
            }
        });
        ch.basicPublish("", q, null, "".getBytes());
        wait(latch);
    }

    public void testNullExceptionHandler() {
      ConnectionFactory cf = new ConnectionFactory();
View Full Code Here

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

            Channel channel = connection.createChannel();

            for (;;) {

                //  Send a message.
                channel.basicPublish("PIPELINE", null, null,
                    "Hello, World???".getBytes());

                //  Sleep for one second.
                Thread.sleep (1000);
            }
View Full Code Here

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

            channel.basicConsume(queueName, true, consumer);

            //  Send the request
            AMQP.BasicProperties properties = new AMQP.BasicProperties();
            properties.setReplyTo(queueName);
            channel.basicPublish("", "REQREP", properties,
                "Hello!".getBytes());

            //  Get and print the reply
            QueueingConsumer.Delivery delivery = consumer.nextDelivery();
            String reply = new String(delivery.getBody());
View Full Code Here

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

                // by AMQP and 0MQ clients for correlating replies
                props.setReplyTo(null);
                System.err.println("processing request");

                //  Send the reply
                channel.basicPublish("", replyTo, props, "World!".getBytes());
            }
        } catch (Exception e) {
            System.err.println("Main thread caught exception: " + e);
            e.printStackTrace();
            System.exit(1);
View Full Code Here

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

            Channel channel = connection.createChannel();

            for (;;) {

                //  Send a message.
                channel.basicPublish("PUBSUB", null, null,
                    "Hello, World???".getBytes());

                //  Sleep for one second.
                Thread.sleep (1000);
            }
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.