Package com.rabbitmq.client

Examples of com.rabbitmq.client.Connection.createChannel()


                System.out.println("Starting connection " + i);
                factory.setUri(uri);
                final Connection conn = factory.newConnection();

                for (int j = 0; j < channelPerConnectionCount; j++) {
                    final Channel ch = conn.createChannel();

                    final int threadNumber = i * channelPerConnectionCount + j;
                    System.out.println("Starting " + threadNumber + " " + ch
                            + " thread...");
                    new Thread(new Runnable() {
View Full Code Here


            ConnectionFactory connFactory = new ConnectionFactory();
            connFactory.setUri(uri);
            Connection conn = connFactory.newConnection();

            final Channel ch = conn.createChannel();

            String queueName =
    (requestedQueueName.equals("")
     ? ch.queueDeclare()
     : ch.queueDeclare(requestedQueueName,
View Full Code Here

        Connection conn;
        Channel ch;
        // Test what happens when a connection is shut down w/o first
        // closing the channels.
        conn = new ConnectionFactory(){{setUri(uri);}}.newConnection();
        ch = conn.createChannel();
        conn.close();
        // Test what happens when we provoke an error
        conn = new ConnectionFactory(){{setUri(uri);}}.newConnection();
        ch = conn.createChannel();
        try {
View Full Code Here

        conn = new ConnectionFactory(){{setUri(uri);}}.newConnection();
        ch = conn.createChannel();
        conn.close();
        // Test what happens when we provoke an error
        conn = new ConnectionFactory(){{setUri(uri);}}.newConnection();
        ch = conn.createChannel();
        try {
            ch.exchangeDeclare("mumble", "invalid");
            throw new RuntimeException("expected shutdown");
        } catch (IOException e) {
        }
View Full Code Here

            throw new RuntimeException("expected shutdown");
        } catch (IOException e) {
        }
        // Test what happens when we just kill the connection
        conn = new ConnectionFactory(){{setUri(uri);}}.newConnection();
        ch = conn.createChannel();
        ((SocketFrameHandler)((AMQConnection)conn).getFrameHandler()).close();
    }

    public static void runProducerConsumerTest(String uri, int commitEvery)
        throws IOException, URISyntaxException, NoSuchAlgorithmException, KeyManagementException
View Full Code Here

public class PerQueueTTLGetter {

    public static void main(String[] args) throws Exception {
        ConnectionFactory factory = new ConnectionFactory();
        Connection connection = factory.newConnection();
        Channel channel = connection.createChannel();

        String queue = "ttl.queue";

        // exchange
        GetResponse response = channel.basicGet(queue, false);
View Full Code Here

            String uri = (args.length > 1) ? args[1] : "amqp://localhost";

            ConnectionFactory cfconn = new ConnectionFactory();
            cfconn.setUri(uri);
            Connection conn = cfconn.newConnection();
            Channel ch = conn.createChannel();
            RpcClient service = new RpcClient(ch, "", "Hello");

            System.out.println(service.stringCall(request));
            conn.close();
        } catch (Exception e) {
View Full Code Here

    }


    public Results run() throws Exception{
        Connection con = new ConnectionFactory(){{setHost(params.host); setPort(params.port);}}.newConnection();
        Channel channel = con.createChannel();

        Results r = new Results(params.maxBindingExp);

        for (int y = 0; y < params.maxBindingExp; y++) {
View Full Code Here

            String message = args[4];

            ConnectionFactory cfconn = new ConnectionFactory();
            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();
View Full Code Here

            ConnectionFactory cfconn = new ConnectionFactory();
            cfconn.setUri(uri);
            Connection conn = cfconn.newConnection();

            Channel ch = conn.createChannel();

            if (exchange.equals("")) {
                ch.queueDeclare(routingKey, false, false, false, null);
            }
            ch.basicPublish(exchange, routingKey, null, message.getBytes());
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.