com.rabbitmq.client.Channel.basicQos()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(711)

本文整理了Java中com.rabbitmq.client.Channel.basicQos()方法的一些代码示例,展示了Channel.basicQos()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Channel.basicQos()方法的具体详情如下:
包路径:com.rabbitmq.client.Channel
类名称:Channel
方法名:basicQos

Channel.basicQos介绍

暂无

代码示例

代码示例来源:origin: Graylog2/graylog2-server

channel.basicQos(prefetchCount);

代码示例来源:origin: spring-projects/spring-amqp

@Override
public void basicQos(int prefetchSize, int prefetchCount, boolean global)
    throws IOException {
  this.delegate.basicQos(prefetchSize, prefetchCount, global);
}

代码示例来源:origin: spring-projects/spring-amqp

/**
 * Added to the 3.3.x client.
 * @since 1.3.3
 */
@Override
public void basicQos(int prefetchCount, boolean global) throws IOException {
  this.delegate.basicQos(prefetchCount, global);
}

代码示例来源:origin: org.springframework.amqp/spring-rabbit

/**
 * Added to the 3.3.x client.
 * @since 1.3.3
 */
@Override
public void basicQos(int prefetchCount, boolean global) throws IOException {
  this.delegate.basicQos(prefetchCount, global);
}

代码示例来源:origin: org.springframework.amqp/spring-rabbit

@Override
public void basicQos(int prefetchSize, int prefetchCount, boolean global)
    throws IOException {
  this.delegate.basicQos(prefetchSize, prefetchCount, global);
}

代码示例来源:origin: spring-projects/spring-amqp

@Override
public void basicQos(int prefetchCount) throws IOException {
  this.delegate.basicQos(prefetchCount);
}

代码示例来源:origin: org.springframework.amqp/spring-rabbit

@Override
public void basicQos(int prefetchCount) throws IOException {
  this.delegate.basicQos(prefetchCount);
}

代码示例来源:origin: meltwater/rxrabbit

@Override
  public void basicQos(int prefetchCount) throws IOException {
    delegate.basicQos(prefetchCount);
  }
}

代码示例来源:origin: gmr/rabbitmq-flume-plugin

private boolean setQoS() {
  try {
    channel.basicQos(prefetchCount);
  } catch (IOException ex) {
    logger.error("Error setting QoS prefetching: {}", ex);
    return false;
  }
  return true;
}

代码示例来源:origin: vert-x3/vertx-rabbitmq-client

@Override
public void basicQos(int prefetchSize, int prefetchCount, boolean global, Handler<AsyncResult<Void>> resultHandler) {
 forChannel(resultHandler, channel -> {
  channel.basicQos(prefetchSize, prefetchCount, global);
  return null;
 });
}

代码示例来源:origin: be.looorent/jflu-subscriber-rabbitmq

private Channel createChannel(Connection connection, Properties properties) throws IOException {
  Channel channel = connection.createChannel();
  String prefetchProperty = PREFETCH_SIZE.readFrom(properties);
  int prefetchSize = prefetchProperty == null || prefetchProperty.isEmpty() ? DEFAULT_PREFETCH_SIZE : parseInt(prefetchProperty);
  LOG.info("Prefetch size of queue is set to {}", prefetchSize);
  channel.basicQos(prefetchSize);
  return channel;
}

代码示例来源:origin: unascribed-archive/Visage

private void reconnect() throws IOException, TimeoutException {
  Visage.log.info("Connecting to RabbitMQ at "+config.getString("rabbitmq.host")+":"+config.getInt("rabbitmq.port"));
  conn = factory.newConnection();
  channel = conn.createChannel();
  if (Visage.debug) Visage.log.finer("Setting up queue '"+queue+"'");
  channel.queueDeclare(queue, false, false, true, null);
  int qos = config.getInt("qos");
  if (qos != -1) {
    channel.basicQos(qos);
  }
}

代码示例来源:origin: reenWYJ/aude-distributed-spider-framework

public MQReceiver(String host, int port, String queue_name, int qos) throws IOException, TimeoutException {
  super(host, port, queue_name);
  channel.basicQos(qos);
  consumer = new QueueingConsumer(channel);
  channel.basicConsume(queue_name, false, consumer);
}

代码示例来源:origin: rabbitmq/rabbitmq-jms-client

Channel createRabbitChannel(boolean transactional) throws IOException {
  Channel channel = this.rabbitConnection.createChannel();
  if(this.channelsQos != NO_CHANNEL_QOS) {
    channel.basicQos(channelsQos);
  }
  if (transactional) {
    channel.txSelect();
  }
  return channel;
}

代码示例来源:origin: Gsantomaggio/rabbitmqexample

public  void StartConsumer() {
  
  try 
  {
    channel = connection.createChannel();
    channel.basicQos(1);
    consumer = new ActualConsumer(channel);
    consumerTag = channel.basicConsume(Constants.queue, false, consumer);
    
  } catch (IOException e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: 794147572/cloud

@RabbitHandler()
@RabbitListener(bindings = @QueueBinding(
    value = @Queue(value = "order-queue", durable = "true"),
    exchange = @Exchange(name = "order-exchange", durable = "true", type = "topic"),
    key = "order.*"
))
public void onOrderMessage(@Payload TOrder order, @Headers Map<String, Object> headers, Channel channel) throws Exception {
  //消费者操作
  channel.basicQos(1);
  log.info("收到消息开始消费,订单编号:{}",order.getId());
  Long deliveryTag = (Long) headers.get(AmqpHeaders.DELIVERY_TAG);
  channel.basicAck(deliveryTag, false);
}

代码示例来源:origin: gudaoxuri/dew

@Override
protected void doResponse(String address, Consumer<String> consumer) {
  Channel channel = rabbitAdapter.getConnection().createChannel(false);
  try {
    channel.queueDeclare(address, true, false, false, null);
    channel.basicQos(1);
    channel.basicConsume(address, false, getDefaultConsumer(channel, address, consumer));
  } catch (IOException e) {
    logger.error("[MQ] Rabbit response error.", e);
  }
}

代码示例来源:origin: wmr513/reactive

public static void main(String[] args) throws Exception {
    Channel channel = AMQPCommon.connect();
    QueueingConsumer consumer = new QueueingConsumer(channel);
    channel.basicQos(1);
    channel.basicConsume("trade.eq.q", false, consumer);

    while (true) {
      QueueingConsumer.Delivery msg = consumer.nextDelivery();
      Thread.sleep(2000);
      System.out.println("Trade placed: " + new String(msg.getBody()));
      channel.basicAck(msg.getEnvelope().getDeliveryTag(), false);
    }            
  }    
}

代码示例来源:origin: gudaoxuri/dew

public void subscribeWithTopic(String topic, String routingKey, String queueName, Consumer<String> consumer) {
  Channel channel = rabbitAdapter.getConnection().createChannel(false);
  try {
    channel.queueDeclare(queueName, true, false, false, null);
    channel.exchangeDeclare(topic, BuiltinExchangeType.TOPIC, true);
    channel.queueBind(queueName, topic, routingKey);
    channel.basicQos(1);
    channel.basicConsume(queueName, false, getDefaultConsumer(channel, topic, consumer));
  } catch (IOException e) {
    logger.error("[MQ] Rabbit subscribeWithTopic error.", e);
  }
}

代码示例来源:origin: gudaoxuri/dew

@Override
protected void doSubscribe(String topic, Consumer<String> consumer) {
  Channel channel = rabbitAdapter.getConnection().createChannel(false);
  try {
    channel.exchangeDeclare(topic, "fanout", true);
    String queueName = channel.queueDeclare().getQueue();
    channel.queueBind(queueName, topic, "");
    channel.basicQos(1);
    channel.basicConsume(queueName, false, getDefaultConsumer(channel, topic, consumer));
  } catch (IOException e) {
    logger.error("[MQ] Rabbit response error.", e);
  }
}

相关文章

微信公众号

最新文章

更多