Package com.rabbitmq.client

Examples of com.rabbitmq.client.ConnectionFactory.newConnection()


            String exchange = (args.length > 2) ? args[2] : null;
            String queue = (args.length > 3) ? args[3] : null;

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

            final Channel channel = conn.createChannel();

            if (exchange == null) {
                exchange = "amq.topic";
View Full Code Here


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

            ConnectionFactory connFactory = new ConnectionFactory();
            connFactory.setUri(uri);
            Connection conn = connFactory.newConnection();
            final Channel ch = conn.createChannel();

            ch.queueDeclare("Hello", false, false, false, null);
            JsonRpcServer server =
                new JsonRpcServer(ch, "Hello", HelloJsonService.class,
View Full Code Here

            String uri = (args.length > 0) ? args[0] : "amqp://localhost";
            String exchange = (args.length > 1) ? args[1] : "amq.rabbitmq.log";

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

            Channel ch1 = conn.createChannel();

            String queueName = ch1.queueDeclare().getQueue();
            ch1.queueBind(queueName, exchange, "#");
View Full Code Here

            ConnectionFactory factory = new ConnectionFactory();
            factory.setRequestedHeartbeat(heartbeatInterval);
            for (int i = 0; i < connectionCount; i++) {
                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;
View Full Code Here

    System.exit(2);
      }

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

            final Channel ch = conn.createChannel();

            String queueName =
    (requestedQueueName.equals("")
View Full Code Here

        factory = new ConnectionFactory();
        factory.setUsername("invalid");
        factory.setPassword("invalid");
        try {
            factory.setUri(uri);
            conn = factory.newConnection();
            conn.close();
            throw new RuntimeException("expected socket close");
        } catch (IOException e) {}

        factory = new ConnectionFactory();
View Full Code Here

        factory = new ConnectionFactory();
        factory.setRequestedChannelMax(10);
        factory.setRequestedFrameMax(8192);
        factory.setRequestedHeartbeat(1);
        factory.setUri(uri);
        conn = factory.newConnection();
        checkNegotiatedMaxValue("channel-max", 10, conn.getChannelMax());
        checkNegotiatedMaxValue("frame-max", 8192, conn.getFrameMax());
        checkNegotiatedMaxValue("heartbeat", 1, conn.getHeartbeat());
        conn.close();
View Full Code Here

        factory = new ConnectionFactory();
        factory.setRequestedChannelMax(0);
        factory.setRequestedFrameMax(0);
        factory.setRequestedHeartbeat(0);
        factory.setUri(uri);
        conn = factory.newConnection();
        checkNegotiatedMaxValue("channel-max", 0, conn.getChannelMax());
        checkNegotiatedMaxValue("frame-max", 0, conn.getFrameMax());
        checkNegotiatedMaxValue("heartbeat", 0, conn.getHeartbeat());
        conn.close();
View Full Code Here

    public static void runProducerConsumerTest(String uri, int commitEvery)
        throws IOException, URISyntaxException, NoSuchAlgorithmException, KeyManagementException
    {
        ConnectionFactory cfconnp = new ConnectionFactory();
        cfconnp.setUri(uri);
        Connection connp = cfconnp.newConnection();
        ProducerMain p = new ProducerMain(connp, 2000, 10000, false, commitEvery, true);
        new Thread(p).start();
        ConnectionFactory cfconnc = new ConnectionFactory();
        cfconnc.setUri(uri);
        Connection connc = cfconnc.newConnection();
View Full Code Here

        Connection connp = cfconnp.newConnection();
        ProducerMain p = new ProducerMain(connp, 2000, 10000, false, commitEvery, true);
        new Thread(p).start();
        ConnectionFactory cfconnc = new ConnectionFactory();
        cfconnc.setUri(uri);
        Connection connc = cfconnc.newConnection();
        ConsumerMain c = new ConsumerMain(connc, false, true);
        c.run();
    }

    public static void sleep(int ms) {
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.