org.apache.qpid.proton.amqp.Symbol.toString()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(89)

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

Symbol.toString介绍

暂无

代码示例

代码示例来源:origin: apache/activemq-artemis

/**
* Check whether the content-type given matches the expect value.
*
* @param expected
*        content type string to compare against or null if not expected to be set
* @param actual
*        the AMQP content type symbol from the Properties section
*
* @return true if content type matches
*/
public static boolean isContentType(String expected, Symbol actual) {
 if (expected == null) {
   return actual == null;
 } else {
   return expected.equals(actual != null ? actual.toString() : actual);
 }
}

代码示例来源:origin: org.apache.qpid/qpid-jms-client

private static Charset getCharsetForTextualContent(Symbol messageContentType) {
    if (messageContentType != null) {
      try {
        return ContentTypeSupport.parseContentTypeForTextualCharset(messageContentType.toString());
      } catch (InvalidContentTypeException e) {
      }
    }

    return null;
  }
}

代码示例来源:origin: apache/qpid-jms

private static Charset getCharsetForTextualContent(Symbol messageContentType) {
    if (messageContentType != null) {
      try {
        return ContentTypeSupport.parseContentTypeForTextualCharset(messageContentType.toString());
      } catch (InvalidContentTypeException e) {
      }
    }

    return null;
  }
}

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

private String encodeSymbol(Symbol o)
{
  StringBuilder b = new StringBuilder(":");
  String sym = o.toString();
  if(needsQuoting(sym))
  {
    b.append(encodeString(sym));
  }
  else
  {
    b.append(sym);
  }
  return b.toString();
}

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

private String encodeSymbol(Symbol o)
{
  StringBuilder b = new StringBuilder(":");
  String sym = o.toString();
  if(needsQuoting(sym))
  {
    b.append(encodeString(sym));
  }
  else
  {
    b.append(sym);
  }
  return b.toString();
}

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

@Override
public String getContentType()
{
  return (_properties == null || _properties.getContentType() == null) ? null : _properties.getContentType().toString();
}

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

@Override
public String getContentType()
{
  return (_properties == null || _properties.getContentType() == null) ? null : _properties.getContentType().toString();
}

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

@Override
public String getContentEncoding()
{
  return (_properties == null || _properties.getContentEncoding() == null) ? null : _properties.getContentEncoding().toString();
}

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

/**
   * Gets an AMQP {@link ErrorCondition} based on this exception's error and description.
   * 
   * @return The condition.
   */
  public ErrorCondition asErrorCondition() {
    return ProtonHelper.condition(error.toString(), getMessage());
  }
}

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

@Override
public String getContentType()
{
  return (_properties == null || _properties.getContentType() == null) ? null : _properties.getContentType().toString();
}

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

/**
   * Gets an AMQP {@link ErrorCondition} based on this exception's error and description.
   * 
   * @return The condition.
   */
  public ErrorCondition asErrorCondition() {
    return ProtonHelper.condition(error.toString(), getMessage());
  }
}

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

@Override
public String getContentType()
{
  return (_properties == null || _properties.getContentType() == null) ? null : _properties.getContentType().toString();
}

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

@Override
public String getContentEncoding()
{
  return (_properties == null || _properties.getContentEncoding() == null) ? null : _properties.getContentEncoding().toString();
}

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

@Override
public String getContentEncoding()
{
  return (_properties == null || _properties.getContentEncoding() == null) ? null : _properties.getContentEncoding().toString();
}

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

@Override
public String getContentEncoding()
{
  return (_properties == null || _properties.getContentEncoding() == null) ? null : _properties.getContentEncoding().toString();
}

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

private static void handleUnknownEndpoint(final ProtonConnection con, final ProtonLink<?> link, final ResourceIdentifier address) {
  LOG.info("client [{}] wants to establish link for unknown endpoint [address: {}]",
      con.getRemoteContainer(), address);
  link.setCondition(
      condition(AmqpError.NOT_FOUND.toString(),
      String.format("no endpoint registered for address %s", address)));
  link.close();
}

代码示例来源:origin: Azure/azure-service-bus-java

public static Exception genereateExceptionFromResponse(Message responseMessage)
{
  Symbol errorCondition = getResponseErrorCondition(responseMessage);
  Object statusDescription = getResponseStatusDescription(responseMessage);
  return generateExceptionFromError(errorCondition, statusDescription == null ? errorCondition.toString() : (String) statusDescription);
}

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

private void forwardMessage(final UpstreamReceiver link, final ProtonDelivery delivery, final Message msg) {
  final ResourceIdentifier messageAddress = ResourceIdentifier.fromString(getAnnotation(msg, APP_PROPERTY_RESOURCE, String.class));
  checkDeviceExists(messageAddress, deviceExists -> {
    if (deviceExists) {
      downstreamAdapter.processMessage(link, delivery, msg);
    } else {
      logger.debug("device {}/{} does not exist, closing link",
          messageAddress.getTenantId(), messageAddress.getResourceId());
      MessageHelper.rejected(delivery, AmqpError.PRECONDITION_FAILED.toString(), "device does not exist");
      link.close(condition(AmqpError.PRECONDITION_FAILED.toString(), "device does not exist"));
    }
  });
}

代码示例来源:origin: apache/activemq-artemis

@Override
  public void sendMessages(String destinationName, int count, RoutingType routingType) throws Exception {
   AmqpClient client = createAmqpClient();
   AmqpConnection connection = addConnection(client.connect());
   try {
     AmqpSession session = connection.createSession();
     AmqpSender sender = session.createSender(destinationName);

     for (int i = 0; i < count; ++i) {
      AmqpMessage message = new AmqpMessage();
      message.setMessageId("MessageID:" + i);
      if (routingType != null) {
        message.setMessageAnnotation(AMQPMessageSupport.ROUTING_TYPE.toString(), routingType.getType());
      }
      sender.send(message);
     }
   } finally {
     connection.close();
   }
  }
}

代码示例来源:origin: apache/activemq-artemis

protected void sendMessages(String destinationName, int count, RoutingType routingType, boolean durable) throws Exception {
 AmqpClient client = createAmqpClient();
 AmqpConnection connection = addConnection(client.connect());
 try {
   AmqpSession session = connection.createSession();
   AmqpSender sender = session.createSender(destinationName);
   for (int i = 0; i < count; ++i) {
    AmqpMessage message = new AmqpMessage();
    message.setMessageId("MessageID:" + i);
    message.setDurable(durable);
    if (routingType != null) {
      message.setMessageAnnotation(AMQPMessageSupport.ROUTING_TYPE.toString(), routingType.getType());
    }
    sender.send(message);
   }
 } finally {
   connection.close();
 }
}

相关文章