Package com.rabbitmq.client

Examples of com.rabbitmq.client.Channel.txSelect()


    }

    @Override
    protected Channel provideChannel() throws IOException {
        Channel channel = super.provideChannel();
        channel.txSelect();
        return  channel;
    }

    static void commitTransaction(Channel channel) throws IOException {
        try {
View Full Code Here


      for (int i = 0; i < consumerCount; i++) {
        System.out.println("starting consumer #" + i);
        Connection conn = consumerConnections[i%connectionCount];
        Channel channel = conn.createChannel();
        if (consumerTxSize > 0)
          channel.txSelect();
        channel.exchangeDeclare(exchangeName, exchangeType);
        String queueName = channel.queueDeclare("", flags.contains("persistent"), true, false, null).getQueue();
        QueueingConsumer consumer = new QueueingConsumer(channel);
        if (prefetchCount > 0)
          channel.basicQos(prefetchCount);
View Full Code Here

        System.out.println("starting producer #" + i);
        Connection conn = factory.newConnection();
        producerConnections[i] = conn;
        Channel channel = conn.createChannel();
        if (producerTxSize > 0)
          channel.txSelect();
        channel.exchangeDeclare(exchangeName, exchangeType);
        final Producer p = new Producer(channel, exchangeName, id, flags, producerTxSize,
            1000L * samplingInterval, rateLimit, minMsgSize, timeLimit, messageCount);
        channel.addReturnListener(p);
        Thread t = new Thread(p);
View Full Code Here

    ccf.setChannelCacheSize(1);

    Connection con = ccf.createConnection();

    Channel channel1 = con.createChannel(true);
    channel1.txSelect();
    channel1.close(); // should be ignored, and add last into channel cache.
    /*
     * When a channel is created as non-transactional we should create a new one.
     */
    Channel channel2 = con.createChannel(false);
View Full Code Here

  public Channel createChannel(boolean transactional) {
    try {
      Channel channel = delegate.createChannel();
      if (transactional) {
        // Just created so we want to start the transaction
        channel.txSelect();
      }
      return channel;
    } catch (IOException e) {
      throw RabbitExceptionTranslator.convertRabbitAccessException(e);
    }
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.