Examples of basicPublish()


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

    {
      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

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

    for (int i = 0; i < count; i++) {
      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

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

                "{ \"type1\" : { \"field1\" : \"value1\" } }\n" +
                "{ \"delete\" : { \"index\" : \"test\", \"type\" : \"type1\", \"id\" : \"2\" } }\n" +
                "{ \"create\" : { \"index\" : \"test\", \"type\" : \"type1\", \"id\" : \"1\" }\n" +
                "{ \"type1\" : { \"field1\" : \"value1\" } }";

        ch.basicPublish("elasticsearch", "elasticsearch", null, message.getBytes());

        ch.close();
        conn.close();

        Thread.sleep(100000);
View Full Code Here

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

          continue;
        }
        if (logger.isLoggable(BasicLevel.DEBUG)) {
          logger.log(BasicLevel.DEBUG, "Sending message on " + cnxName);
        }
        chan.basicPublish("", amqpQueue, props, message.body);
        channels.get(cnxName); // Access the used connection to update the LRU map
        return;
      } catch (IOException exc) {
        if (logger.isLoggable(BasicLevel.DEBUG)) {
          logger.log(BasicLevel.DEBUG, "Channel is not usable, remove from table.", exc);
View Full Code Here

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

            if (isRoutable(message)) {
                Connection connection = connectionFactory.newConnection();
                Channel channel = connection.createChannel();
                channel.exchangeDeclare(AMQPUtil.EXCHANGE_NAME_FANOUT, AMQPUtil.EXCHANGE_TYPE_FANOUT);

                channel.basicPublish(AMQPUtil.EXCHANGE_NAME_FANOUT, "", null, message.toString().getBytes());

                channel.close();
                connection.close();
            }
        } catch (IOException e) {
View Full Code Here

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

                List<String> routingKeys = new ArrayList<String>();
                getRoutingKeys(message, routingKeys);

                for (String routingKey : routingKeys) {
                    channel.basicPublish(
                            AMQPUtil.EXCHANGE_NAME_TOPIC, routingKey, null, message.toString().getBytes());
                }

                channel.close();
                connection.close();
View Full Code Here

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

                List<String> routingKeys = new ArrayList<String>();
                getRoutingKeys(message, routingKeys);

                for (String routingKey : routingKeys) {
                    channel.basicPublish(
                            AMQPUtil.EXCHANGE_NAME_DIRECT, routingKey, null, message.toString().getBytes());
                }
               
                channel.close();
                connection.close();
View Full Code Here

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

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

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

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

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

          response = "" + fib(n);
        } catch (Exception e) {
          System.out.println(" [.] " + e.toString());
          response = "";
        } finally {
          channel.basicPublish("", props.getReplyTo(), replyProps,
              response.getBytes("UTF-8"));
          channel.basicAck(delivery.getEnvelope().getDeliveryTag(),
              false);
        }
      }
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.