org.apache.qpid.proton.message.Message.getReplyTo()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(11.6k)|赞(0)|评价(0)|浏览(146)

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

Message.getReplyTo介绍

暂无

代码示例

代码示例来源:origin: eclipse/hono

/**
 * Adds a property for the address that responses to
 * this (request) message should be sent.
 * <p>
 * The property will only be added if the AMQP message contains
 * a non-{@code null} <em>reply-to</em> property.
 * 
 * @param msg The AMQP message to retrieve the value from.
 * @return This message for chaining.
 */
public EventBusMessage setReplyToAddress(final Message msg) {
  setReplyToAddress(msg.getReplyTo());
  return this;
}

代码示例来源:origin: Azure/azure-event-hubs-java

if (amqpMessage.getSubject() != null)
  receiveProperties.put(AmqpConstants.AMQP_PROPERTY_SUBJECT, amqpMessage.getSubject());
if (amqpMessage.getReplyTo() != null)
  receiveProperties.put(AmqpConstants.AMQP_PROPERTY_REPLY_TO, amqpMessage.getReplyTo());
if (amqpMessage.getCorrelationId() != null)
  receiveProperties.put(AmqpConstants.AMQP_PROPERTY_CORRELATION_ID, amqpMessage.getCorrelationId());

代码示例来源:origin: org.eclipse.hono/hono-core

/**
 * Adds a property for the address that responses to
 * this (request) message should be sent.
 * <p>
 * The property will only be added if the AMQP message contains
 * a non-{@code null} <em>reply-to</em> property.
 * 
 * @param msg The AMQP message to retrieve the value from.
 * @return This message for chaining.
 */
public EventBusMessage setReplyToAddress(final Message msg) {
  setReplyToAddress(msg.getReplyTo());
  return this;
}

代码示例来源:origin: org.apache.qpid/proton

private void adjustReplyTo(Message m)
{
  String original = m.getReplyTo();
  if (original == null || original.length() == 0)
  {
    m.setReplyTo("amqp://" + _name);
  }
  else if (original.startsWith("~/"))
  {
    m.setReplyTo("amqp://" + _name + "/" + original.substring(2));
  }
}

代码示例来源:origin: org.apache.qpid/proton-j-impl

private void adjustReplyTo(Message m)
{
  String original = m.getReplyTo();
  if (original != null) {
    if (original.startsWith("~/"))
    {
      m.setReplyTo("amqp://" + _name + "/" + original.substring(2));
    }
    else if (original.equals("~"))
    {
      m.setReplyTo("amqp://" + _name);
    }
  }
}

代码示例来源:origin: com.microsoft.azure.iot/proton-j-azure-iot

private void adjustReplyTo(Message m)
{
  String original = m.getReplyTo();
  if (original != null) {
    if (original.startsWith("~/"))
    {
      m.setReplyTo("amqp://" + _name + "/" + original.substring(2));
    }
    else if (original.equals("~"))
    {
      m.setReplyTo("amqp://" + _name);
    }
  }
}

代码示例来源:origin: EnMasseProject/enmasse

public Message request(Message message, long timeout, TimeUnit timeUnit) {
  Map<String, Object> properties = new HashMap<>();
  if (message.getApplicationProperties() != null) {
    properties.putAll(message.getApplicationProperties().getValue());
  }
  message.setApplicationProperties(new ApplicationProperties(properties));
  if (message.getReplyTo() == null) {
    message.setReplyTo(replyTo);
  }
  context.runOnContext(h -> sender.send(message));
  try {
    return replies.poll(timeout, timeUnit);
  } catch (InterruptedException e) {
    throw new RuntimeException(e);
  }
}

代码示例来源:origin: Azure/azure-event-hubs-java

public void request(
    final Message message,
    final OperationResult<Message, Exception> onResponse) {
  if (message == null)
    throw new IllegalArgumentException("message cannot be null");
  if (message.getMessageId() != null)
    throw new IllegalArgumentException("message.getMessageId() should be null");
  if (message.getReplyTo() != null)
    throw new IllegalArgumentException("message.getReplyTo() should be null");
  message.setMessageId("request" + UnsignedLong.valueOf(this.requestId.incrementAndGet()).toString());
  message.setReplyTo(this.replyTo);
  this.inflightRequests.put(message.getMessageId(), onResponse);
  sendLink.delivery(UUID.randomUUID().toString().replace("-", StringUtil.EMPTY).getBytes());
  final int payloadSize = AmqpUtil.getDataSerializedSize(message) + 512; // need buffer for headers
  final byte[] bytes = new byte[payloadSize];
  final int encodedSize = message.encode(bytes, 0, payloadSize);
  receiveLink.flow(1);
  sendLink.send(bytes, 0, encodedSize);
  sendLink.advance();
}

代码示例来源:origin: org.eclipse.hono/hono-client

if (message.getReplyTo() != null) {
  try {
    final ResourceIdentifier replyTo = ResourceIdentifier.fromString(message.getReplyTo());
    if (!CommandConstants.COMMAND_ENDPOINT.equals(replyTo.getEndpoint())) {

代码示例来源:origin: eclipse/hono

/**
   * Checks whether a given tenant message contains all required properties.
   * 
   * @param linkTarget The resource path to check the message's properties against for consistency.
   * @param msg The AMQP 1.0 message to perform the checks on.
   * @return {@code true} if the message passes all checks.
   */
  public static boolean verify(final ResourceIdentifier linkTarget, final Message msg) {

    if (msg.getMessageId() == null && msg.getCorrelationId() == null) {
      LOG.trace("message has neither a message-id nor correlation-id");
      return false;
    } else if (msg.getSubject() == null) {
      LOG.trace("message [{}] does not contain subject", msg.getMessageId());
      return false;
    } else if (msg.getReplyTo() == null) {
      LOG.trace("message [{}] contains no reply-to address", msg.getMessageId());
      return false;
    } else if (msg.getBody() != null && !MessageHelper.hasDataBody(msg)) {
      LOG.trace("message [{}] contains no Data section payload", msg.getMessageId());
      return false;
    } else {
      return true;
    }
  }
}

代码示例来源:origin: strimzi/strimzi-kafka-bridge

if (message.getSubject() != null)
  jsonProperties.put(AmqpJsonMessageConverter.SUBJECT, message.getSubject());
if (message.getReplyTo() != null)
  jsonProperties.put(AmqpJsonMessageConverter.REPLY_TO, message.getReplyTo());
if (message.getCorrelationId() != null)
  jsonProperties.put(AmqpJsonMessageConverter.CORRELATION_ID, message.getCorrelationId());

代码示例来源:origin: eclipse/hono

/**
 * Checks whether a given credentials message contains all required properties.
 *
 * @param linkTarget The resource path to check the message's properties against for consistency.
 * @param msg The AMQP 1.0 message to perform the checks on.
 * @return {@code true} if the message passes all checks.
 */
public static boolean verify(final ResourceIdentifier linkTarget, final Message msg) {
  if (msg.getMessageId() == null && msg.getCorrelationId() == null) {
    LOG.trace("message has neither a message-id nor correlation-id");
    return false;
  } else if (!CredentialsConstants.CredentialsAction.isValid(msg.getSubject())) {
    LOG.trace("message [{}] does not contain valid subject property", msg.getMessageId());
    return false;
  } else if (msg.getReplyTo() == null) {
    LOG.trace("message [{}] has no reply-to address set", msg.getMessageId());
    return false;
  } else if (!MessageHelper.hasDataBody(msg)) {
    LOG.trace("message [{}] contains no Data section payload", msg.getMessageId());
    return false;
  } else {
    return true;
  }
}

代码示例来源:origin: org.eclipse.hono/hono-service-base

/**
 * Checks whether a given credentials message contains all required properties.
 *
 * @param linkTarget The resource path to check the message's properties against for consistency.
 * @param msg The AMQP 1.0 message to perform the checks on.
 * @return {@code true} if the message passes all checks.
 */
public static boolean verify(final ResourceIdentifier linkTarget, final Message msg) {
  if (msg.getMessageId() == null && msg.getCorrelationId() == null) {
    LOG.trace("message has neither a message-id nor correlation-id");
    return false;
  } else if (!CredentialsConstants.CredentialsAction.isValid(msg.getSubject())) {
    LOG.trace("message [{}] does not contain valid subject property", msg.getMessageId());
    return false;
  } else if (msg.getReplyTo() == null) {
    LOG.trace("message [{}] has no reply-to address set", msg.getMessageId());
    return false;
  } else if (!MessageHelper.hasDataBody(msg, true)) {
    LOG.trace("message [{}] contains no AmqpValue or Data section payload", msg.getMessageId());
    return false;
  } else {
    return true;
  }
}

代码示例来源:origin: org.eclipse.hono/hono-service-base

/**
   * Checks whether a given tenant message contains all required properties.
   * 
   * @param linkTarget The resource path to check the message's properties against for consistency.
   * @param msg The AMQP 1.0 message to perform the checks on.
   * @return {@code true} if the message passes all checks.
   */
  public static boolean verify(final ResourceIdentifier linkTarget, final Message msg) {

    if (msg.getMessageId() == null && msg.getCorrelationId() == null) {
      LOG.trace("message has neither a message-id nor correlation-id");
      return false;
    } else if (msg.getSubject() == null) {
      LOG.trace("message [{}] does not contain subject", msg.getMessageId());
      return false;
    } else if (msg.getReplyTo() == null) {
      LOG.trace("message [{}] contains no reply-to address", msg.getMessageId());
      return false;
    } else if (msg.getBody() != null && !MessageHelper.hasDataBody(msg, true)) {
      LOG.trace("message [{}] contains no AmqpValue or Data section payload", msg.getMessageId());
      return false;
    } else {
      return true;
    }
  }
}

代码示例来源:origin: org.eclipse.hono/hono-server

private void processRequest(final Message msg) {
  final JsonObject registrationMsg = RegistrationConstants.getRegistrationMsg(msg);
  vertx.eventBus().send(EVENT_BUS_ADDRESS_REGISTRATION_IN, registrationMsg,
      result -> {
        JsonObject response = null;
        if (result.succeeded()) {
          // TODO check for correct session here...?
          response = (JsonObject) result.result().body();
        } else {
          logger.debug("failed to process request [msg ID: {}] due to {}", msg.getMessageId(), result.cause());
          // we need to inform client about failure
          response = RegistrationConstants.getReply(
              HttpURLConnection.HTTP_INTERNAL_ERROR,
              MessageHelper.getTenantIdAnnotation(msg),
              MessageHelper.getDeviceIdAnnotation(msg),
              null);
        }
        addHeadersToResponse(msg, response);
        vertx.eventBus().send(msg.getReplyTo(), response);
      });
}

代码示例来源:origin: eclipse/hono

/**
   * Checks whether a given registration message contains all required properties.
   * 
   * @param linkTarget The resource path to check the message's properties against for consistency.
   * @param msg The AMQP 1.0 message to perform the checks on.
   * @return {@code true} if the message passes all checks.
   */
   public static boolean verify(final ResourceIdentifier linkTarget, final Message msg) {

     if (!hasValidDeviceId(linkTarget, msg)) {
       return false;
     } else if (!hasCorrelationId(msg)) {
       return false;
     } else if (!RegistrationConstants.isValidAction(msg.getSubject())) {
       LOG.trace("message [{}] does not contain valid action property", msg.getMessageId());
       return false;
     } else if (msg.getReplyTo() == null) {
       LOG.trace("message [{}] contains no reply-to address", msg.getMessageId());
       return false;
    } else if (msg.getBody() != null && !MessageHelper.hasDataBody(msg)) {
      LOG.trace("message [{}] contains no Data section payload", msg.getMessageId());
      return false;
     } else {
       return true;
     }
  }
}

代码示例来源:origin: org.eclipse.hono/hono-server

LOG.trace("message [{}] does not contain valid action property", msg.getMessageId());
  return false;
} else if (msg.getReplyTo() == null) {
  LOG.trace("message [{}] contains no reply-to address", msg.getMessageId());
  return false;

代码示例来源:origin: org.eclipse.hono/hono-service-base

/**
   * Checks whether a given registration message contains all required properties.
   * 
   * @param linkTarget The resource path to check the message's properties against for consistency.
   * @param msg The AMQP 1.0 message to perform the checks on.
   * @return {@code true} if the message passes all checks.
   */
   public static boolean verify(final ResourceIdentifier linkTarget, final Message msg) {

     if (!hasValidDeviceId(linkTarget, msg)) {
       return false;
     } else if (!hasCorrelationId(msg)) {
       return false;
     } else if (!RegistrationConstants.isValidAction(msg.getSubject())) {
       LOG.trace("message [{}] does not contain valid action property", msg.getMessageId());
       return false;
     } else if (msg.getReplyTo() == null) {
       LOG.trace("message [{}] contains no reply-to address", msg.getMessageId());
       return false;
    } else if (msg.getBody() != null && !MessageHelper.hasDataBody(msg, true)) {
      LOG.trace("message [{}] contains no AmqpValue or Data section payload", msg.getMessageId());
      return false;
     } else {
       return true;
     }
  }
}

代码示例来源:origin: org.eclipse.hono/hono-service-base

final String replyTo = message.getReplyTo();

代码示例来源:origin: eclipse/hono

final String replyTo = message.getReplyTo();

相关文章