Examples of DeclareOk


Examples of com.rabbitmq.client.AMQP.Queue.DeclareOk

            1);

        Assert.isNull(
            message.getMessageProperties().getReplyTo(),
            "Send-and-receive methods can only be used if the Message does not already have a replyTo property.");
        DeclareOk queueDeclaration = channel.queueDeclare();
        String replyTo = queueDeclaration.getQueue();
        message.getMessageProperties().setReplyTo(replyTo);

        String consumerTag = UUID.randomUUID().toString();
        DefaultConsumer consumer = new DefaultConsumer(channel) {
View Full Code Here

Examples of com.rabbitmq.client.AMQP.Queue.DeclareOk

        super(aConnectionSettings);

        this.setDurable(isDurable);

        try {
            DeclareOk result =
                this.channel().queueDeclare(
                        aName,
                        isDurable,
                        isExclusive,
                        isAutoDeleted,
                        null);

            this.setName(result.getQueue());

        } catch (IOException e) {
            throw new MessageException("Failed to create/open the queue.", e);
        }
    }
View Full Code Here

Examples of com.rabbitmq.client.AMQP.Queue.DeclareOk

        super(aBrokerChannel);

        this.setDurable(isDurable);

        try {
            DeclareOk result =
                this.channel().queueDeclare(
                        aName,
                        isDurable,
                        isExclusive,
                        isAutoDeleted,
                        null);

            this.setName(result.getQueue());

        } catch (IOException e) {
            throw new MessageException("Failed to create/open the queue.", e);
        }
    }
View Full Code Here

Examples of com.rabbitmq.client.AMQP.Queue.DeclareOk

    connectionFactory.setHost("localhost");
    connectionFactory.setPort(BrokerTestUtils.getPort());
    Connection connection = connectionFactory.newConnection();
    Channel channel = connection.createChannel();
    try {
      DeclareOk result = channel.queueDeclarePassive(queue.getName());
      return result != null;
    } catch (IOException e) {
      return e.getCause().getMessage().contains("RESOURCE_LOCKED");
    } finally {
      connection.close();
View Full Code Here

Examples of com.rabbitmq.client.AMQP.Queue.DeclareOk

   * Declares a server-named exclusive, autodelete, non-durable queue.
   */
  @Override
  @ManagedOperation
  public Queue declareQueue() {
    DeclareOk declareOk = this.rabbitTemplate.execute(new ChannelCallback<DeclareOk>() {
      @Override
      public DeclareOk doInRabbit(Channel channel) throws Exception {
        return channel.queueDeclare();
      }
    });
    Queue queue = new Queue(declareOk.getQueue(), false, true, true);
    return queue;
  }
View Full Code Here

Examples of com.rabbitmq.client.AMQP.Queue.DeclareOk

    Assert.hasText(queueName, "'queueName' cannot be null or empty");
    return this.rabbitTemplate.execute(new ChannelCallback<Properties>() {
      @Override
      public Properties doInRabbit(Channel channel) throws Exception {
        try {
          DeclareOk declareOk = channel.queueDeclarePassive(queueName);
          Properties props = new Properties();
          props.put(QUEUE_NAME, declareOk.getQueue());
          props.put(QUEUE_MESSAGE_COUNT, declareOk.getMessageCount());
          props.put(QUEUE_CONSUMER_COUNT, declareOk.getConsumerCount());
          return props;
        }
        catch (Exception e) {
          if (logger.isDebugEnabled()) {
            logger.debug("Queue '" + queueName + "' does not exist");
View Full Code Here

Examples of com.rabbitmq.client.AMQP.Queue.DeclareOk

      if (!queue.getName().startsWith("amq.")) {
        if (logger.isDebugEnabled()) {
          logger.debug("declaring Queue '" + queue.getName() + "'");
        }
        try {
          DeclareOk declareOk = channel.queueDeclare(queue.getName(), queue.isDurable(), queue.isExclusive(), queue.isAutoDelete(),
              queue.getArguments());
          declareOks[i] = declareOk;
        }
        catch (IOException e) {
          if (this.ignoreDeclarationExceptions) {
View Full Code Here

Examples of com.rabbitmq.client.AMQP.Queue.DeclareOk

      public Message doInRabbit(Channel channel) throws Exception {
        final ArrayBlockingQueue<Message> replyHandoff = new ArrayBlockingQueue<Message>(1);

        Assert.isNull(message.getMessageProperties().getReplyTo(),
            "Send-and-receive methods can only be used if the Message does not already have a replyTo property.");
        DeclareOk queueDeclaration = channel.queueDeclare();
        String replyTo = queueDeclaration.getQueue();
        message.getMessageProperties().setReplyTo(replyTo);

        String consumerTag = UUID.randomUUID().toString();
        DefaultConsumer consumer = new DefaultConsumer(channel) {
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.