Tabnine Logo
MessageProperties.getConsumerQueue
Code IndexAdd Tabnine to your IDE (free)

How to use
getConsumerQueue
method
in
org.springframework.amqp.core.MessageProperties

Best Java code snippets using org.springframework.amqp.core.MessageProperties.getConsumerQueue (Showing top 14 results out of 315)

origin: openzipkin/brave

void setConsumerSpan(Span span, MessageProperties properties) {
 span.name("next-message").kind(CONSUMER);
 maybeTag(span, RABBIT_EXCHANGE, properties.getReceivedExchange());
 maybeTag(span, RABBIT_ROUTING_KEY, properties.getReceivedRoutingKey());
 maybeTag(span, RABBIT_QUEUE, properties.getConsumerQueue());
 if (remoteServiceName != null) span.remoteServiceName(remoteServiceName);
}
origin: spring-projects/spring-integration

private void addConsumerMetadata(MessageProperties messageProperties, Map<String, Object> headers) {
  String consumerTag = messageProperties.getConsumerTag();
  if (consumerTag != null) {
    headers.put(AmqpHeaders.CONSUMER_TAG, consumerTag);
  }
  String consumerQueue = messageProperties.getConsumerQueue();
  if (consumerQueue != null) {
    headers.put(AmqpHeaders.CONSUMER_QUEUE, consumerQueue);
  }
}
origin: org.springframework.integration/spring-integration-amqp

private void addConsumerMetadata(MessageProperties messageProperties, Map<String, Object> headers) {
  String consumerTag = messageProperties.getConsumerTag();
  if (consumerTag != null) {
    headers.put(AmqpHeaders.CONSUMER_TAG, consumerTag);
  }
  String consumerQueue = messageProperties.getConsumerQueue();
  if (consumerQueue != null) {
    headers.put(AmqpHeaders.CONSUMER_QUEUE, consumerQueue);
  }
}
origin: spring-projects/spring-amqp

/**
 * Determine the name of the listener method that will handle the given message.
 * <p>
 * The default implementation first consults the
 * {@link #setQueueOrTagToMethodName(Map) queueOrTagToMethodName} map looking for a
 * match on the consumer queue or consumer tag; if no match found, it simply returns
 * the configured default listener method, or "handleMessage" if not configured.
 * @param originalMessage the Rabbit request message
 * @param extractedMessage the converted Rabbit request message, to be passed into the
 * listener method as argument
 * @return the name of the listener method (never <code>null</code>)
 * @see #setDefaultListenerMethod
 * @see #setQueueOrTagToMethodName
 */
protected String getListenerMethodName(Message originalMessage, Object extractedMessage) {
  if (this.queueOrTagToMethodName.size() > 0) {
    MessageProperties props = originalMessage.getMessageProperties();
    String methodName = this.queueOrTagToMethodName.get(props.getConsumerQueue());
    if (methodName == null) {
      methodName = this.queueOrTagToMethodName.get(props.getConsumerTag());
    }
    if (methodName != null) {
      return methodName;
    }
  }
  return getDefaultListenerMethod();
}
origin: org.springframework.amqp/spring-rabbit

/**
 * Determine the name of the listener method that will handle the given message.
 * <p>
 * The default implementation first consults the
 * {@link #setQueueOrTagToMethodName(Map) queueOrTagToMethodName} map looking for a
 * match on the consumer queue or consumer tag; if no match found, it simply returns
 * the configured default listener method, or "handleMessage" if not configured.
 * @param originalMessage the Rabbit request message
 * @param extractedMessage the converted Rabbit request message, to be passed into the
 * listener method as argument
 * @return the name of the listener method (never <code>null</code>)
 * @see #setDefaultListenerMethod
 * @see #setQueueOrTagToMethodName
 */
protected String getListenerMethodName(Message originalMessage, Object extractedMessage) {
  if (this.queueOrTagToMethodName.size() > 0) {
    MessageProperties props = originalMessage.getMessageProperties();
    String methodName = this.queueOrTagToMethodName.get(props.getConsumerQueue());
    if (methodName == null) {
      methodName = this.queueOrTagToMethodName.get(props.getConsumerTag());
    }
    if (methodName != null) {
      return methodName;
    }
  }
  return getDefaultListenerMethod();
}
origin: spring-projects/spring-amqp-samples

@Override
public boolean isFatal(Throwable t) {
  if (t instanceof ListenerExecutionFailedException) {
    ListenerExecutionFailedException lefe = (ListenerExecutionFailedException) t;
    logger.error("Failed to process inbound message from queue "
        + lefe.getFailedMessage().getMessageProperties().getConsumerQueue()
        + "; failed message: " + lefe.getFailedMessage(), t);
  }
  return super.isFatal(t);
}
origin: org.springframework.cloud/spring-cloud-stream-binder-rabbit

this.routingKey != null ? this.routingKey : messageProperties.getConsumerQueue(),
amqpMessage);
origin: spring-cloud/spring-cloud-stream-binder-rabbit

this.routingKey != null ? this.routingKey : messageProperties.getConsumerQueue(),
amqpMessage);
origin: societe-generale/rabbitmq-advanced-spring-boot-starter

@Override
public void recover(final Message message, final Throwable cause) {
 Map<String, Object> headers = message.getMessageProperties().getHeaders();
 headers.put("x-exception-stacktrace", ExceptionUtils.getFullStackTrace(cause));
 headers.put("x-exception-message", ExceptionUtils.getMessage(cause));
 headers.put("x-exception-root-cause-message", ExceptionUtils.getRootCauseMessage(cause));
 headers.put("x-original-exchange", message.getMessageProperties().getReceivedExchange());
 headers.put("x-original-routingKey", message.getMessageProperties().getReceivedRoutingKey());
 headers.put("x-original-queue", message.getMessageProperties().getConsumerQueue());
 headers.put("x-recover-time", new Date().toString());
 String deadLetterExchangeName = rabbitmqProperties.getDeadLetterConfig().getDeadLetterExchange().getName();
 String deadLetterRoutingKey = rabbitmqProperties.getDeadLetterConfig().createDeadLetterQueueName(message.getMessageProperties().getConsumerQueue());
 headers.put("x-dead-letter-exchange", deadLetterExchangeName);
 headers.put("x-dead-letter-queue", deadLetterRoutingKey);
 if(headers.containsKey("correlation-id")) {
  message.getMessageProperties().setCorrelationIdString((String) headers.get("correlation-id"));
 }
 headers.putAll(loadAdditionalHeaders(message, cause));
 for (MessageExceptionHandler messageExceptionHandler : messageExceptionHandlers) {
  try {
   messageExceptionHandler.handle(message, cause);
  } catch (Exception e) {
   // To catch any exception in the  MessageExceptionHandler to avoid the interruption in other MessageExceptionHandlers
   log.error("Exception occurred while processing '{}' message exception handler.", messageExceptionHandler, e);
  }
 }
 this.errorTemplate.send(deadLetterExchangeName, deadLetterRoutingKey, message);
 log.warn("Republishing failed message to exchange '{}', routing key '{}', message {{}} , cause {}",
     deadLetterExchangeName, deadLetterRoutingKey, message, cause);
}
origin: spring-projects/spring-amqp

  headers.put(AmqpHeaders.CONSUMER_TAG, consumerTag);
String consumerQueue = amqpMessageProperties.getConsumerQueue();
if (StringUtils.hasText(consumerQueue)) {
  headers.put(AmqpHeaders.CONSUMER_QUEUE, consumerQueue);
origin: lianggzone/rabbitmq-server

@Override
public void onMessage(Message message, Channel channel) throws Exception {
  System.out.println(message.getMessageProperties().getConsumerQueue());
  try {
    // 解析RabbitMQ消息体
    String messageBody = new String(message.getBody());
    MailMessageModel mailMessageModel = JSONObject.toJavaObject(JSONObject.parseObject(messageBody), MailMessageModel.class);
    // 发送邮件
    String to =  mailMessageModel.getTo();
    String subject = mailMessageModel.getSubject();
    String text = mailMessageModel.getText();
    sendHtmlMail(to, subject, text);
    // 手动ACK
    channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
  }catch (Exception e){
    e.printStackTrace();
  }
}
origin: io.opentracing.contrib/opentracing-spring-rabbitmq

void onReceive(MessageProperties messageProperties, Span span) {
 Tags.COMPONENT.set(span, RabbitMqTracingTags.RABBITMQ);
 RabbitMqTracingTags.EXCHANGE.set(span, messageProperties.getReceivedExchange());
 RabbitMqTracingTags.MESSAGE_ID.set(span, messageProperties.getMessageId());
 RabbitMqTracingTags.ROUTING_KEY.set(span, messageProperties.getReceivedRoutingKey());
 RabbitMqTracingTags.CONSUMER_QUEUE.set(span, messageProperties.getConsumerQueue());
}
origin: spring-projects/spring-amqp

@Test
public void testMessage1ArgDirect() throws Exception {
  this.latch.set(new CountDownLatch(1));
  ListenableFuture<Message> future1 = this.asyncDirectTemplate.sendAndReceive(getFooMessage());
  ListenableFuture<Message> future2 = this.asyncDirectTemplate.sendAndReceive(getFooMessage());
  this.latch.get().countDown();
  Message reply1 = checkMessageResult(future1, "FOO");
  assertEquals(Address.AMQ_RABBITMQ_REPLY_TO, reply1.getMessageProperties().getConsumerQueue());
  Message reply2 = checkMessageResult(future2, "FOO");
  assertEquals(Address.AMQ_RABBITMQ_REPLY_TO, reply2.getMessageProperties().getConsumerQueue());
  this.latch.set(null);
  waitForZeroInUseConsumers();
  assertThat(TestUtils
        .getPropertyValue(this.asyncDirectTemplate, "directReplyToContainer.consumerCount", Integer.class),
      equalTo(2));
  this.asyncDirectTemplate.stop();
  this.asyncDirectTemplate.start();
  assertThat(TestUtils
        .getPropertyValue(this.asyncDirectTemplate, "directReplyToContainer.consumerCount", Integer.class),
      equalTo(0));
}
origin: spring-projects/spring-amqp

assertEquals(3, messages.size());
assertEquals(consumerTag, messages.get(0).getMessageProperties().getConsumerTag());
assertEquals("foobar", messages.get(0).getMessageProperties().getConsumerQueue());
Executors.newSingleThreadExecutor().execute(() -> container.stop());
consumer.get().handleCancelOk(consumerTag);
org.springframework.amqp.coreMessagePropertiesgetConsumerQueue

Popular methods of MessageProperties

  • getDeliveryTag
  • <init>
  • setHeader
  • getHeaders
  • setExpiration
  • setContentType
  • getReplyTo
  • getCorrelationId
  • getMessageId
  • getReceivedRoutingKey
  • setCorrelationId
  • setDeliveryMode
  • setCorrelationId,
  • setDeliveryMode,
  • setReplyTo,
  • getReceivedExchange,
  • getContentType,
  • getExpiration,
  • setContentEncoding,
  • setMessageId,
  • getAppId

Popular in Java

  • Making http post requests using okhttp
  • setRequestProperty (URLConnection)
  • startActivity (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Top Sublime Text plugins
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