congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Channel.queueDeclare
Code IndexAdd Tabnine to your IDE (free)

How to use
queueDeclare
method
in
com.rabbitmq.client.Channel

Best Java code snippets using com.rabbitmq.client.Channel.queueDeclare (Showing top 20 results out of 945)

origin: apache/flink

/**
 * Sets up the queue. The default implementation just declares the queue. The user may override
 * this method to have a custom setup for the queue (i.e. binding the queue to an exchange or
 * defining custom queue parameters)
 */
protected void setupQueue() throws IOException {
  if (queueName != null) {
    channel.queueDeclare(queueName, false, false, false, null);
  }
}
origin: apache/flink

/**
 * Sets up the queue. The default implementation just declares the queue. The user may override
 * this method to have a custom setup for the queue (i.e. binding the queue to an exchange or
 * defining custom queue parameters)
 */
protected void setupQueue() throws IOException {
  channel.queueDeclare(queueName, true, false, false, null);
}
origin: Graylog2/graylog2-server

channel.queueDeclare(queueName, true, false, false, null);
if (exchangeBind) {
  channel.queueBind(queueName, exchange, routingKey);
origin: testcontainers/testcontainers-java

@Test
public void simpleRabbitMqTest() throws IOException, TimeoutException {
  ConnectionFactory factory = new ConnectionFactory();
  factory.setHost(rabbitMq.getContainerIpAddress());
  factory.setPort(rabbitMq.getMappedPort(RABBITMQ_PORT));
  Connection connection = factory.newConnection();
  Channel channel = connection.createChannel();
  channel.exchangeDeclare(RABBIQMQ_TEST_EXCHANGE, "direct", true);
  String queueName = channel.queueDeclare().getQueue();
  channel.queueBind(queueName, RABBIQMQ_TEST_EXCHANGE, RABBITMQ_TEST_ROUTING_KEY);
  // Set up a consumer on the queue
  final boolean[] messageWasReceived = new boolean[1];
  channel.basicConsume(queueName, false, new DefaultConsumer(channel) {
    @Override
    public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
      messageWasReceived[0] = Arrays.equals(body, RABBITMQ_TEST_MESSAGE.getBytes());
    }
  });
  // post a message
  channel.basicPublish(RABBIQMQ_TEST_EXCHANGE, RABBITMQ_TEST_ROUTING_KEY, null, RABBITMQ_TEST_MESSAGE.getBytes());
  // check the message was received
  assertTrue("The message was received", Unreliables.retryUntilSuccess(5, TimeUnit.SECONDS, () -> {
    if (!messageWasReceived[0]) {
      throw new IllegalStateException("Message not received yet");
    }
    return true;
  }));
}
origin: yacy/yacy_grid_mcp

private void connect() throws IOException {
    Map<String, Object> arguments = new HashMap<>();
    arguments.put("x-queue-mode", "lazy"); // we want to minimize memory usage; see http://www.rabbitmq.com/lazy-queues.html
    boolean lazys = lazy.get();
    try {
      RabbitQueueFactory.this.channel.queueDeclare(this.queueName, true, false, false, lazys ? arguments : null);
    } catch (AlreadyClosedException e) {
      lazys = !lazys;
      try {
        channel = connection.createChannel();
        // may happen if a queue was previously not declared "lazy". So we try non-lazy queue setting now.
        RabbitQueueFactory.this.channel.queueDeclare(this.queueName, true, false, false, lazys ? arguments : null);
        // if this is successfull, set the new lazy value
        lazy.set(lazys);
      } catch (AlreadyClosedException ee) {
        throw new IOException(ee.getMessage());
      }
  }
}

origin: apache/incubator-druid

channel.queueDeclare(queue, durable, exclusive, autoDelete, null);
channel.queueBind(queue, exchange, routingKey);
channel.addShutdownListener(
origin: zstackio/zstack

public void construct() {
  try {
    eventChan = conn.createChannel();
    eventChan.queueDeclare(queueName, false, false, true, queueArguments());
    eventChan.basicConsume(queueName, true, this);
  } catch (IOException e) {
    throw new CloudRuntimeException(e);
  }
}
origin: zstackio/zstack

public void construct() {
  try {
    nrouteChan = conn.createChannel();
    nrouteChan.queueDeclare(nrouteName, false, false, true, null);
    nrouteChan.queueBind(nrouteName, BusExchange.NO_ROUTE.toString(), "");
    nrouteChan.basicConsume(nrouteName, true, this);
  } catch (IOException e) {
    throw new CloudRuntimeException(e);
  }
}
origin: vector4wang/spring-boot-quick

  public static void main(String[] args) {
    try {
      ConnectionFactory factory = new ConnectionFactory();
      factory.setUsername("guest");
      factory.setPassword("guest");
      factory.setHost("60.205.191.82");
      factory.setPort(5672);
      Connection conn = factory.newConnection();
      Channel channel = conn.createChannel();

//            channel.qu
      channel.queueDeclare("hello", false, false, false, null);
      String message = "Hello World!";
      channel.basicPublish("", "hello", null, message.getBytes());
      System.out.println(" [x] Sent '" + message + "'");

      channel.close();
      conn.close();
    } catch (IOException e) {
      e.printStackTrace();
    } catch (TimeoutException e) {
      e.printStackTrace();
    }
  }
}
origin: zstackio/zstack

void init() {
  try {
    ConnectionFactory connFactory = new ConnectionFactory();
    List<Address> addresses = CollectionUtils.transformToList(bus.getServerIps(), new Function<Address, String>() {
      @Override
      public Address call(String arg) {
        return Address.parseAddress(arg);
      }
    });
    conn = connFactory.newConnection(addresses.toArray(new Address[]{}));
    chan = conn.createChannel();
    String name = MessageTracker.class.getName();
    chan.queueDeclare(name, true, false, true, null);
    chan.basicConsume(name, true, this);
    chan.queueBind(name, BusExchange.P2P.toString(), "#");
    chan.queueBind(name, BusExchange.BROADCAST.toString(), "#");
  } catch (Exception e) {
    throw new CloudRuntimeException(e);
  }
}
origin: spring-projects/spring-amqp

@Override
public com.rabbitmq.client.AMQP.Queue.DeclareOk queueDeclare()
    throws IOException {
  return this.delegate.queueDeclare();
}
origin: spring-projects/spring-amqp

@Override
public com.rabbitmq.client.AMQP.Queue.DeclareOk queueDeclare(String queue,
    boolean durable, boolean exclusive, boolean autoDelete,
    Map<String, Object> arguments) throws IOException {
  return this.delegate.queueDeclare(queue, durable, exclusive, autoDelete,
      arguments);
}
origin: zstackio/zstack

chan.queueDeclare(name, false, false, true, null);
chan.basicConsume(name, true, tracker);
chan.queueBind(name, BusExchange.BROADCAST.toString(), "#");
origin: spring-projects/spring-integration

@SuppressWarnings("unchecked")
@Test
public void testPtP() throws Exception {
  final Channel channel = mock(Channel.class);
  DeclareOk declareOk = mock(DeclareOk.class);
  when(declareOk.getQueue()).thenReturn("noSubscribersChannel");
  when(channel.queueDeclare(anyString(), anyBoolean(), anyBoolean(), anyBoolean(), isNull()))
      .thenReturn(declareOk);
  Connection connection = mock(Connection.class);
  doAnswer(invocation -> channel).when(connection).createChannel(anyBoolean());
  ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
  when(connectionFactory.createConnection()).thenReturn(connection);
  SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
  container.setConnectionFactory(connectionFactory);
  AmqpTemplate amqpTemplate = mock(AmqpTemplate.class);
  PointToPointSubscribableAmqpChannel amqpChannel =
      new PointToPointSubscribableAmqpChannel("noSubscribersChannel", container, amqpTemplate);
  amqpChannel.setBeanName("noSubscribersChannel");
  amqpChannel.setBeanFactory(mock(BeanFactory.class));
  amqpChannel.afterPropertiesSet();
  MessageListener listener = (MessageListener) container.getMessageListener();
  try {
    listener.onMessage(new Message("Hello world!".getBytes(), null));
    fail("Exception expected");
  }
  catch (MessageDeliveryException e) {
    assertThat(e.getMessage(),
        containsString("Dispatcher has no subscribers for amqp-channel 'noSubscribersChannel'."));
  }
}
origin: zstackio/zstack

outboundQueue = new BusQueue(makeMessageQueueName(SERVICE_ID), BusExchange.P2P);
Channel chan = channelPool.acquire();
chan.queueDeclare(outboundQueue.getName(), false, false, true, queueArguments());
chan.basicConsume(outboundQueue.getName(), true, consumer);
chan.queueBind(outboundQueue.getName(), outboundQueue.getBusExchange().toString(), outboundQueue.getBindingKey());
origin: com.intrbiz.bergamot/bergamot-queue

protected String setupQueue(Channel on) throws IOException
{
  String queueName = on.queueDeclare().getQueue();
  on.exchangeDeclare("bergamot.update", "topic", true);
  on.queueBind(queueName, "bergamot.update", (site == null ? "*" : site.toString()) + "." + (check == null ? "*" : check.toString()));
  return queueName;
}

origin: com.intrbiz.bergamot/bergamot-queue

  public String setupQueue(Channel on) throws IOException
  {
    on.queueDeclare("bergamot.reading.fallback_queue", true, false, false, null);
    on.exchangeDeclare("bergamot.reading.fallback", "fanout", true, false, null);
    on.queueBind("bergamot.reading.fallback_queue", "bergamot.reading.fallback", "");
    return "bergamot.reading.fallback_queue";
  }
};
origin: com.intrbiz.bergamot/bergamot-queue

  public String setupQueue(Channel on) throws IOException
  {
    // exchange
    on.exchangeDeclare("bergamot.notification", "topic", true);
    // queue
    String queueName = on.queueDeclare().getQueue();
    // bind using the site
    on.queueBind(queueName, "bergamot.notification", site == null ? "#" : site.toString());
    return queueName;
  }
};
origin: imalexyang/ExamStack

@Bean
QueueingConsumer queueingConsumer() throws IOException {
  ConnectionFactory factory = new ConnectionFactory();
  factory.setHost(messageQueueHostname);
  Connection connection = factory.newConnection();
  Channel channel = connection.createChannel();
  channel.queueDeclare(Constants.ANSWERSHEET_DATA_QUEUE, true, false, false, null);
  QueueingConsumer consumer = new QueueingConsumer(channel);
  channel.basicConsume(Constants.ANSWERSHEET_DATA_QUEUE, true, consumer);
  return consumer;
}
origin: addthis/hydra

@Override public void open() throws IOException {
  getChannel().exchangeDeclare(exchange, "direct");
  getChannel().queueDeclare(queueName, true, false, false, null);
  for (String routingKey : routingKeys) {
    getChannel().queueBind(queueName, exchange, routingKey);
  }
  getChannel().basicConsume(queueName, false, this);
}
com.rabbitmq.clientChannelqueueDeclare

Popular methods of Channel

  • basicPublish
  • close
  • basicConsume
  • basicAck
  • exchangeDeclare
  • queueBind
  • isOpen
  • basicQos
  • basicCancel
  • basicNack
  • basicGet
  • confirmSelect
  • basicGet,
  • confirmSelect,
  • queueDeclarePassive,
  • queueDelete,
  • basicReject,
  • exchangeDeclarePassive,
  • queueUnbind,
  • getConnection,
  • txCommit

Popular in Java

  • Updating database using SQL prepared statement
  • getSystemService (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now