Examples of basicPublish()


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

      // Use the builder to create the BasicProperties object.
      AMQP.BasicProperties theProps = builder.build();

      // Now we add the headers.  This example only uses string headers, but they can also be integers
      channel.basicPublish(EXCHANGE_NAME, routingKey, theProps, message.getBytes());
      System.out.println(" [x] Sent message: '" + message + "'");

    }
    catch  (Exception e) {
      e.printStackTrace();
View Full Code Here

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

    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()

   
    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();
View Full Code Here

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

        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

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

    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()

      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()

    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()

    Map<String, Object> headers = new HashMap<String, Object>();
    headers.put("filename", filename);
    headers.put("length", (int) f.length());
    BasicProperties props = new BasicProperties.Builder().headers(headers).build();
    ch.basicPublish(exchange, routingKey, props, body);
    System.out.println(" done.");
      }

      conn.close();
        } catch (Exception ex) {
View Full Code Here

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

            int thisTimeCount = 0;
            int allTimeCount = 0;
            long startTime = System.currentTimeMillis();
            long nextSummaryTime = startTime;
            while (true) {
                ch.basicPublish(exchange, topicPrefix + newSuffix(), null, message.getBytes());
                thisTimeCount++;
                allTimeCount++;
                long now = System.currentTimeMillis();
                if (now > nextSummaryTime) {
                    int thisTimeRate = (int)(1.0 * thisTimeCount / (now - nextSummaryTime + SUMMARISE_EVERY) * SUMMARISE_EVERY);
 
View Full Code Here

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

          try {
            Channel ch = conn.createChannel();
            while(true){
                ch.close();
                ch = conn.createChannel();
                ch.basicPublish(
                  EXCHANGE,
                  "", null,
                  new byte[1024 * 1024]
                );
                ch.basicGet(QUEUE, true);
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.