Examples of basicPublish()


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

        return connection;
    }

    private void publish(Connection connection) throws IOException {
        Channel ch = connection.createChannel();
        ch.basicPublish("", "", MessageProperties.BASIC, "".getBytes());
    }
}
View Full Code Here

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

            cfconn.setUri(uri);
            Connection conn = cfconn.newConnection();
            Channel ch = conn.createChannel();

            ch.exchangeDeclare(exchange, exchangeType);
            ch.basicPublish(exchange, routingKey, null, message.getBytes());
            ch.close();
            conn.close();
        } catch (Exception e) {
            System.err.println("Main thread caught exception: " + e);
            e.printStackTrace();
View Full Code Here

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

            Channel ch = conn.createChannel();

            if (exchange.equals("")) {
                ch.queueDeclare(routingKey, false, false, false, null);
            }
            ch.basicPublish(exchange, routingKey, null, message.getBytes());
            ch.close();
            conn.close();
        } catch (Exception e) {
            System.err.println("Main thread caught exception: " + e);
            e.printStackTrace();
View Full Code Here

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

        chan.queuePurge(q);
        chan.basicQos(1);

        trace("Building backlog out to " + backlogSize + " messages, each " + bodySize + " bytes long");
        for (int i = 0; i < backlogSize; i++) {
            chan.basicPublish("", q, props, body);
        }

        redeclare(q, chan);

        trace("Beginning plateau of " + repeatCount + " repeats, sampling every " + sampleGranularity + " messages");
View Full Code Here

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

                                    (100 * i / repeatCount),
                                    now,
                                    delta));
                startTime = System.currentTimeMillis();
            }
            chan.basicPublish("", q, props, body);
            QueueingConsumer.Delivery d = consumer.nextDelivery();
            chan.basicAck(d.getEnvelope().getDeliveryTag(), false);
        }
        System.out.println();

View Full Code Here

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

            ch.queueDeclare(SERVER_QUEUE, false, true, false, null);
            ch.basicConsume(SERVER_QUEUE, true, new DefaultConsumer(ch) {
                @Override
                public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
                    String replyTo = properties.getReplyTo();
                    ch.basicPublish("", replyTo, MessageProperties.MINIMAL_BASIC, "Hello client!".getBytes());
                }
            });
        }
    }
View Full Code Here

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

                    ch = conn.createChannel();
                }

                String replyTo = strategy.preMsg(ch, cons);
                AMQP.BasicProperties props = MessageProperties.MINIMAL_BASIC.builder().replyTo(replyTo).build();
                ch.basicPublish("", SERVER_QUEUE, props, "Hello server!".getBytes());
                latch[0].await();
                strategy.postMsg(ch);
                if (!reuseConnection) {
                    conn.close();
                }
View Full Code Here

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

        channel.queueBind(queue, exchange, queue, null);

        // send a message
        AMQP.BasicProperties props = new AMQP.BasicProperties.Builder().deliveryMode(2).build();
        for(int x = 0; x < 10; x++) {
            channel.basicPublish(exchange, queue, props, ("Msg [" + x + "]").getBytes());
        }

        System.out.println("Done");
        channel.close();
        connection.close();
View Full Code Here

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

            } else {
                ch.exchangeDeclare(exchange, "topic");
            }

            System.out.println("Sending to exchange " + exchange + ", topic " + topic);
            ch.basicPublish(exchange, topic, null, message.getBytes());
            ch.close();
            conn.close();
        } catch (Exception e) {
            System.err.println("Main thread caught exception: " + e);
            e.printStackTrace();
View Full Code Here

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

                                   byte[] body) {
            throw new RuntimeException("I am a bad consumer");
        }
    });

    channel.basicPublish("x", "k", null, new byte[10]);

    assertTrue(closeLatch.await(1000, TimeUnit.MILLISECONDS));
    assertTrue(connection.hadValidShutdown());
  }
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.