Package com.rabbitmq.client

Examples of com.rabbitmq.client.ConnectionFactory


    /* server should reject frames larger than AMQP.FRAME_MIN_SIZE
     * during connection negotiation */
    public void testRejectLargeFramesDuringConnectionNegotiation()
        throws IOException
    {
        ConnectionFactory cf = new ConnectionFactory();
        cf.getClientProperties().put("too_long", LongStringHelper.asLongString(new byte[AMQP.FRAME_MIN_SIZE]));
        try {
            cf.newConnection();
            fail("Expected exception during connection negotiation");
        } catch (IOException e) {
        }
    }
View Full Code Here


    public void testRejectExceedingFrameMax()
        throws IOException
    {
        closeChannel();
        closeConnection();
        ConnectionFactory cf = new GenerousConnectionFactory();
        connection = cf.newConnection();
        openChannel();
        try {
            basicPublishVolatile(new byte[connection.getFrameMax()], "void");
            channel.basicQos(0);
            fail("Expected exception when publishing");
View Full Code Here

/**
* Check that protocol negotiation works
*/
public class ConnectionOpen extends TestCase {
    public void testCorrectProtocolHeader() throws IOException {
        ConnectionFactory factory = new ConnectionFactory();
        SocketFrameHandler fh = new SocketFrameHandler(factory.getSocketFactory().createSocket("localhost", AMQP.PROTOCOL.PORT));
        fh.sendHeader();
        AMQCommand command = new AMQCommand();
        while (!command.handleFrame(fh.readFrame())) { }
        Method m = command.getMethod();
        //    System.out.println(m.getClass());
View Full Code Here

    return this;
  }

  public Server init()
  throws Exception {
    ConnectionFactory factory = new ConnectionFactory();
    factory.setUsername("rpc_user");
    factory.setPassword("rpcme");
    connection = factory.newConnection();
    channel = connection.createChannel();

    channel.exchangeDeclare("rpc", "direct");
    channel.queueDeclare("ping", false, false, false, null);
    channel.queueBind("ping", "rpc", "ping");
View Full Code Here

  private String replyQueueName;
  private QueueingConsumer consumer;

  public Client init()
  throws Exception {
    ConnectionFactory factory = new ConnectionFactory();
    factory.setUsername("rpc_user");
    factory.setPassword("rpcme");
    connection = factory.newConnection();
    channel = connection.createChannel();
    return this;
  }
View Full Code Here

            String hostName = (args.length > 0) ? args[0] : "localhost";
            int portNumber = (args.length > 1) ?
                Integer.parseInt(args[1]) : AMQP.PROTOCOL.PORT;

            //  Connect to the AMQP broker
            ConnectionFactory factory = new ConnectionFactory();
            factory.setHost(hostName);
            factory.setPort(portNumber);
            Connection connection = factory.newConnection();
            Channel channel = connection.createChannel();

            for (;;) {

                //  Send a message.
View Full Code Here

            String hostName = (args.length > 0) ? args[0] : "localhost";
            int portNumber = (args.length > 1) ?
                Integer.parseInt(args[1]) : AMQP.PROTOCOL.PORT;

            //  Connect to the AMQP broker
            ConnectionFactory factory = new ConnectionFactory();
            factory.setHost(hostName);
            factory.setPort(portNumber);
            Connection connection = factory.newConnection();
            Channel channel = connection.createChannel();

            //  Establish the REQ/REP wiring.
            String queueName = channel.queueDeclare().getQueue();
            QueueingConsumer consumer = new QueueingConsumer(channel);
View Full Code Here

            String hostName = (args.length > 0) ? args[0] : "localhost";
            int portNumber = (args.length > 1) ?
                Integer.parseInt(args[1]) : AMQP.PROTOCOL.PORT;

            //  Connect to the AMQP broker
            ConnectionFactory factory = new ConnectionFactory();
            factory.setHost(hostName);
            factory.setPort(portNumber);
            Connection connection = factory.newConnection();
            Channel channel = connection.createChannel();

            //  Establish the PUB/SUB wiring
            String queueName = channel.queueDeclare().getQueue();
            channel.queueBind(queueName, "PIPELINE", null);
View Full Code Here

            String hostName = (args.length > 0) ? args[0] : "localhost";
            int portNumber = (args.length > 1) ?
                Integer.parseInt(args[1]) : AMQP.PROTOCOL.PORT;

            //  Connect to the AMQP broker
            ConnectionFactory factory = new ConnectionFactory();
            factory.setHost(hostName);
            factory.setPort(portNumber);
            Connection connection = factory.newConnection();
            Channel channel = connection.createChannel();

            //  Establish the REQ/REP wiring.
            channel.queueDeclare("REQREP", true, false, false, null);
            QueueingConsumer consumer = new QueueingConsumer(channel);
View Full Code Here

            String hostName = (args.length > 0) ? args[0] : "localhost";
            int portNumber = (args.length > 1) ?
                Integer.parseInt(args[1]) : AMQP.PROTOCOL.PORT;

            //  Connect to the AMQP broker
            ConnectionFactory factory = new ConnectionFactory();
            factory.setHost(hostName);
            factory.setPort(portNumber);
            Connection connection = factory.newConnection();
            Channel channel = connection.createChannel();

            //  Establish the PUB/SUB wiring
            String queueName = channel.queueDeclare().getQueue();
            channel.queueBind(queueName, "PUBSUB", null);
View Full Code Here

TOP

Related Classes of com.rabbitmq.client.ConnectionFactory

Copyright © 2018 www.massapicom. 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.