Package com.rabbitmq.client

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


            for (int i = 1; i <= n; i++) {
                assertNotNull(conn.createChannel(i));
            }
            // ChannelManager guards against channel.open being sent
            assertNull(conn.createChannel(n + 1));

            // Construct a channel directly
            final ChannelN ch = new ChannelN((AMQConnection) conn, n + 1,
                                             new ConsumerWorkService(Executors.newSingleThreadExecutor(),
                                                     Executors.defaultThreadFactory(), ConnectionFactory.DEFAULT_SHUTDOWN_TIMEOUT));
View Full Code Here


    }

    private void startPublisher() throws IOException, InterruptedException {

        final Connection conn = connectionFactory.newConnection();
        final Channel pubCh = conn.createChannel();

        //This forces the initialisation of the guid generation, which
        //is an interaction with the persister and not something we
        //want to see delay things.
        publish(pubCh);
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

            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

    public void publishOneInOneOutReceive(int backlogSize, int bodySize, int repeatCount, int sampleGranularity) throws IOException, InterruptedException {
        String q = "test";
        BasicProperties props = MessageProperties.MINIMAL_PERSISTENT_BASIC;
        Connection conn = newConnection();
        Channel chan = conn.createChannel();
        byte[] body = new byte[bodySize];
        List<Long> plateauSampleTimes = new ArrayList<Long>(repeatCount);
        List<Double> plateauSampleDeltas = new ArrayList<Double>(repeatCount);

        trace("Declaring and purging queue " + q);
View Full Code Here

            ConnectionFactory connFactory = new ConnectionFactory();
            connFactory.setHost(hostName);
            connFactory.setPort(portNumber);
            Connection conn = connFactory.newConnection();
            final Channel ch = conn.createChannel();

            ch.queueDeclare("Hello", false, false, false, null);
            StringRpcServer server = new StringRpcServer(ch, "Hello") {
                    public String handleStringCall(String request) {
                        System.out.println("Got request: " + request);
View Full Code Here

        public void run() throws Exception {
            ConnectionFactory factory = new ConnectionFactory();
            factory.setUri(uri);
            Connection connection = factory.newConnection();
            final Channel ch = connection.createChannel();
            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();
View Full Code Here

            Consumer cons = new ClientConsumer(latch);
            Connection conn = null;
            Channel ch = null;
            if (reuseConnection) {
                conn = factory.newConnection();
                ch = conn.createChannel();
            }
            for (int i = 0; i < RPC_COUNT_PER_CLIENT; i++) {
                latch[0] = new CountDownLatch(1);
                if (!reuseConnection) {
                    conn = factory.newConnection();
View Full Code Here

            }
            for (int i = 0; i < RPC_COUNT_PER_CLIENT; i++) {
                latch[0] = new CountDownLatch(1);
                if (!reuseConnection) {
                    conn = factory.newConnection();
                    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());
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.