Package com.rabbitmq.client

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


    Connection connection = null;
    Channel channel = null;
    try {
      ConnectionFactory factory = new ConnectionFactory();
      factory.setHost("localhost");
      connection = factory.newConnection();
      channel = connection.createChannel();
      channel.exchangeDeclare(EXCHANGE_NAME, "topic");
      String queueName = channel.queueDeclare().getQueue();
      if (argv.length < 1) {
        System.err.println("Usage: ReceiveLogsTopic [binding_key]...");
View Full Code Here


            factory.setVirtualHost(getVhost());
        }
        factory.setHost(getHostname());
        factory.setPort(getPortNumber());
        if (getAddresses() == null) {
            return factory.newConnection(executor);
        } else {
            return factory.newConnection(executor, getAddresses());
        }
    }
View Full Code Here

        factory.setHost(getHostname());
        factory.setPort(getPortNumber());
        if (getAddresses() == null) {
            return factory.newConnection(executor);
        } else {
            return factory.newConnection(executor, getAddresses());
        }
    }

    @Override
    public Producer createProducer() throws Exception {
View Full Code Here

        factory.setHost("localhost");
        factory.setPort(5672);
        factory.setUsername("cameltest");
        factory.setPassword("cameltest");
        factory.setVirtualHost("/");
        Connection conn = factory.newConnection();

        final List<Envelope> received = new ArrayList<Envelope>();

        Channel channel = conn.createChannel();
        channel.queueDeclare("sammyq", false, false, true, null);
View Full Code Here

        factory.setHost("localhost");
        factory.setPort(5672);
        factory.setUsername("cameltest");
        factory.setPassword("cameltest");
        factory.setVirtualHost("/");
        Connection conn = factory.newConnection();

        AMQP.BasicProperties.Builder properties = new AMQP.BasicProperties.Builder();
        properties.replyTo("myReply");

        Channel channel = conn.createChannel();
View Full Code Here

   
    Connection conn = null;
    Channel channel = null;
   
    try {
      conn = factory.newConnection();
      channel = conn.createChannel();
      PurgeOk ok = channel.queuePurge(je.getQueue());
      _logger.info("purged queue: " +je.getQueue() + " result: " + ok.toString() + " on " + je.getFetcherQConf().getHost() + "," + je.getFetcherQConf().getVhost());
      return true;
    } catch (IOException e) {
View Full Code Here

    factory.setPort(this.getFetcherQConf().getPort());
   
    Connection conn = null;
    Channel channel = null;
    try {
      conn = factory.newConnection();
      // in one thread
      channel = conn.createChannel();
      String exchangeName = getExchange();//"image_admin_exchange";
      String type = this.getType();
      String queueName = getQueue();//"image_admin";
View Full Code Here

    Calendar timer = Calendar.getInstance();
    timer.setTime(sdf.parse(cmd.getOptionValue("start", "2010-01-01T00:00:00")));

    String msg_template = "{\"utcdt\": \"%s\", \"wp\": %d, \"gender\": \"%s\", \"age\": %d}";

    Connection connection = factory.newConnection();
    Channel channel = connection.createChannel();

    channel.exchangeDeclare(exchange, type, durable, autoDelete, null);

    do{
View Full Code Here

        if (clusteredConnection == null) {
            try {
                ConnectionFactory cf2 = connectionFactory.clone();
                cf2.setHost("localhost");
                cf2.setPort(5673);
                clusteredConnection = cf2.newConnection();
            }
            catch (IOException e) {
                // Must be no secondary node
            }
        }
View Full Code Here

        customFactory.setUsername(username);
        customFactory.setPassword(password);
        Map<String, Object> customProperties = AMQConnection.defaultClientProperties();
        customProperties.remove("capabilities");
        customFactory.setClientProperties(customProperties);
        return customFactory.newConnection();
    }

    private void loginOk(String name, byte[][] responses) throws IOException {
        ConnectionFactory factory = new ConnectionFactory();
        factory.setSaslConfig(new Config(name, responses));
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.