javax.jms.Message.propertyExists()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(10.6k)|赞(0)|评价(0)|浏览(151)

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

Message.propertyExists介绍

[英]Indicates whether a property value exists.
[中]指示属性值是否存在。

代码示例

代码示例来源:origin: org.apache.tomee/openejb-core

@Override
public boolean propertyExists(final String name) throws JMSException {
  return message.propertyExists(name);
}

代码示例来源:origin: org.jboss.jbossas/jboss-as-connector

public boolean propertyExists(String name) throws JMSException
{
 return message.propertyExists(name);
}

代码示例来源:origin: org.jboss.genericjms/generic-jms-ra-jar

public boolean propertyExists(String name) throws JMSException {
  return message.propertyExists(name);
}

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

/**
* Do property exist
* @param name The name
* @return The value
* @exception JMSException Thrown if an error occurs
*/
public boolean propertyExists(final String name) throws JMSException
{
 if (_log.isTraceEnabled())
 {
   _log.trace("propertyExists(" + name + ")");
 }
 return _message.propertyExists(name);
}

代码示例来源:origin: org.apache.uima/uimaj-as-jms

public boolean propertyExists(String aKey) throws AsynchAEException {
 try {
  return message.propertyExists(aKey);
 } catch (Exception e) {
  throw new AsynchAEException(e);
 }
}

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

@Override
public void send(Destination destination, Message message) throws JMSException {
  internalSend((RMQDestination) destination, message,
    message.propertyExists(JMS_MESSAGE_DELIVERY_MODE) ? message.getJMSDeliveryMode() : getDeliveryMode(),
    message.propertyExists(JMS_MESSAGE_PRIORITY) ? message.getJMSPriority() : getPriority(),
    message.propertyExists(JMS_MESSAGE_EXPIRATION) ? message.getJMSExpiration() : getTimeToLive(),
    message.propertyExists(JMS_MESSAGE_EXPIRATION) ? MessageExpirationType.EXPIRATION : MessageExpirationType.TTL);
}

代码示例来源:origin: org.apache.uima/uimaj-as-jms

private boolean isException(Message message) throws Exception {
 int payload;
 if (message.propertyExists(AsynchAEMessage.Payload)) {
  payload = ((Integer) message.getIntProperty(AsynchAEMessage.Payload)).intValue();
 } else {
  throw new InvalidMessageException("Message Does not Contain Payload property");
 }
 return (AsynchAEMessage.Exception == payload ? true : false);
}

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

/**
* Do property exist
*
* @param name The name
* @return The value
* @throws JMSException Thrown if an error occurs
*/
@Override
public boolean propertyExists(final String name) throws JMSException {
 if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
   ActiveMQRALogger.LOGGER.trace("propertyExists(" + name + ")");
 }
 return message.propertyExists(name);
}

代码示例来源:origin: org.jboss.jbossas/jboss-as-connector

protected boolean handleDelivery(Message msg)
  {
   int max = maxResent;
   try
   {
     if (msg.propertyExists(JMS_JBOSS_REDELIVERY_LIMIT))
      max = msg.getIntProperty(JMS_JBOSS_REDELIVERY_LIMIT);

     if (msg.propertyExists(JMS_JBOSS_REDELIVERY_COUNT))
     {
      int count = msg.getIntProperty(JMS_JBOSS_REDELIVERY_COUNT);
           if (count > max)
      {
        warnDLQ(msg, count, max);
        return true;
      }
     }
   }
   catch (Throwable t)
   {
     log.warn("Unexpected error retrieving message properties " + msg, t);
   }
   return false;
  }
}

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

/**
* Do property exist
*
* @param name The name
* @return The value
* @throws JMSException Thrown if an error occurs
*/
@Override
public boolean propertyExists(final String name) throws JMSException {
 if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
   ActiveMQRALogger.LOGGER.trace("propertyExists(" + name + ")");
 }
 return message.propertyExists(name);
}

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

private KapuaConnectionContext parseMessageSession(javax.jms.Message message) throws JMSException, KapuaException {
  Long scopeId = message.propertyExists(MessageConstants.PROPERTY_SCOPE_ID) ? message.getLongProperty(MessageConstants.PROPERTY_SCOPE_ID) : null;
  String clientId = message.getStringProperty(MessageConstants.PROPERTY_CLIENT_ID);
  if (scopeId == null || scopeId <= 0 || StringUtils.isEmpty(clientId)) {
    logger.debug("Invalid message context. Try parsing the topic.");
    throw new KapuaException(KapuaErrorCodes.ILLEGAL_ARGUMENT, "Invalid message context");
  }
  return new KapuaConnectionContext(scopeId, clientId, MULTI_ACCOUNT_CLIENT_ID);
}

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

@Override
  public String getRelatedEventIdentifier(Message message) throws ManagedEventIdentifierException
  {
    try
    {
      if (message.propertyExists(ManagedRelatedEventIdentifierService.RELATED_EVENT_LIFE_ID))
      {
        return message.getStringProperty(ManagedRelatedEventIdentifierService.RELATED_EVENT_LIFE_ID);
      }
      else
      {
        return null;
      }
    }
    catch (JMSException e)
    {
      throw new ManagedEventIdentifierException("Failed to get " + ManagedRelatedEventIdentifierService.RELATED_EVENT_LIFE_ID + " from JMS message", e);
    }
  }
}

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

if (!jmsMessage.propertyExists(name)) {
  return null;

代码示例来源:origin: org.apache.uima/uimaj-as-jms

private void deserializeAndCompleteProcessingReply(String casReferenceId, Message message,
    ClientRequest cachedRequest, ProcessTrace pt, boolean doNotify) throws Exception {
 if (!running) {
  return;
 }
 int payload = ((Integer) message.getIntProperty(AsynchAEMessage.Payload)).intValue();
 if (message.propertyExists(AsynchAEMessage.CasSequence)) {
  handleProcessReplyFromCasMultiplier(message, casReferenceId, payload);// , cachedRequest);
 } else {
  long t1 = System.nanoTime();
  boolean deltaCas = false;
  if (message.propertyExists(AsynchAEMessage.SentDeltaCas)) {
   deltaCas = message.getBooleanProperty(AsynchAEMessage.SentDeltaCas);
  }
  CAS cas = null;
  if (message instanceof TextMessage) {
   cas = deserializeCAS(((TextMessage) message).getText(), cachedRequest, deltaCas);
  } else {
   long bodyLength = ((BytesMessage) message).getBodyLength();
   byte[] serializedCas = new byte[(int) bodyLength];
   ((BytesMessage) message).readBytes(serializedCas);
   cas = deserializeCAS(serializedCas, cachedRequest);
  }
  cachedRequest.setDeserializationTime(System.nanoTime() - t1);
  completeProcessingReply(cas, casReferenceId, payload, doNotify, message, cachedRequest, pt);
 }
}

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

protected void populateMessage(Message message, NormalizedMessage normalizedMessage) throws Exception {
  if (message instanceof TextMessage) {
    PhaseInterceptorChain chain = new PhaseInterceptorChain();
    chain.add(new AttachmentsInInterceptor());
    chain.add(new StaxInInterceptor());
    org.apache.servicemix.soap.api.Message msg = new MessageImpl();
    msg.setContent(InputStream.class, new ByteArrayInputStream(((TextMessage) message).getText().getBytes()));
    if (message.propertyExists(CONTENT_TYPE_PROPERTY)) {
      msg.put(org.apache.servicemix.soap.api.Message.CONTENT_TYPE, message.getStringProperty(CONTENT_TYPE_PROPERTY));
    }
    chain.doIntercept(msg);
    XMLStreamReader xmlReader = msg.getContent(XMLStreamReader.class);
    normalizedMessage.setContent(new StaxSource(xmlReader));
    for (Map.Entry<String, DataHandler> attachment : msg.getAttachments().entrySet()) {
      normalizedMessage.addAttachment(attachment.getKey(), attachment.getValue());
    }
  } else {
    throw new UnsupportedOperationException("JMS message is not a TextMessage");
  }
}

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

public void populateMessage(Message message, MessageExchange exchange, NormalizedMessage normalizedMessage) throws Exception {
  if (message instanceof TextMessage) {
    PhaseInterceptorChain chain = new PhaseInterceptorChain();
    chain.add(new AttachmentsInInterceptor());
    chain.add(new StaxInInterceptor());
    org.apache.servicemix.soap.api.Message msg = new MessageImpl();
    msg.setContent(InputStream.class, new ByteArrayInputStream(((TextMessage) message).getText().getBytes()));
    if (message.propertyExists(CONTENT_TYPE_PROPERTY)) {
      msg.put(org.apache.servicemix.soap.api.Message.CONTENT_TYPE, message.getStringProperty(CONTENT_TYPE_PROPERTY));
    }
    chain.doIntercept(msg);
    XMLStreamReader xmlReader = msg.getContent(XMLStreamReader.class);
    normalizedMessage.setContent(new StaxSource(xmlReader));
    for (Map.Entry<String, DataHandler> attachment : msg.getAttachments().entrySet()) {
      normalizedMessage.addAttachment(attachment.getKey(), attachment.getValue());
    }
    if (isCopyProperties()) {
      copyPropertiesFromJMS(message, normalizedMessage);
    }
  } else {
    throw new UnsupportedOperationException("JMS message is not a TextMessage");
  }
}

代码示例来源:origin: com.github.jbricks.soap2jms/s2j_common

public WsJmsMessage jmsToSoap(final Message message, final JMSImplementation impl) throws JMSException {
  JMSMessageClassEnum messageType = JMSMessageClassEnum.UNSUPPORTED;
  for (final Map.Entry<Class<? extends Message>, JMSMessageClassEnum> entry : ENUM_BY_CLASS.entrySet()) {
    if (entry.getKey().isInstance(message)) {
      messageType = entry.getValue();
    }
  }
  final List<Headers> headers = convertHeaders(message);
  String clientId = null;
  if (JMSImplementation.ARTEMIS_ACTIVE_MQ.equals(impl)
      && message.propertyExists(SoapToJmsSerializer.ACTIVEMQ_DUPLICATE_ID)) {
    clientId = message.getStringProperty(SoapToJmsSerializer.ACTIVEMQ_DUPLICATE_ID);
  }
  final DataHandler bodyStream = extractBody(message, messageType);
  final WsJmsMessage wsmessage = new WsJmsMessage(headers, message.getJMSCorrelationID(),
      message.getJMSDeliveryMode(), message.getJMSDeliveryTime(), message.getJMSExpiration(), // expiration
      message.getJMSMessageID(), message.getJMSPriority(), message.getJMSRedelivered(), //
      message.getJMSTimestamp(), message.getJMSType(), //
      clientId, messageType.toString(), bodyStream);
  return wsmessage;
}

代码示例来源:origin: de.mhus.lib/mhu-lib-jms

if (msg.propertyExists(ClientObjectProxy.PROP_DIRECT_MSG) && msg.getBooleanProperty(ClientObjectProxy.PROP_DIRECT_MSG)) {
  obj = new Object[] { msg };
} else

代码示例来源:origin: de.mhus.lib/mhu-lib-jms

if (msg.propertyExists(ClientService.PROP_DIRECT_MSG) && msg.getBooleanProperty(ClientService.PROP_DIRECT_MSG)) {
  obj = new Object[] { msg };
} else

代码示例来源:origin: apache/cxf

private void read(Message message) throws JMSException {
  setJMSCorrelationID(message.getJMSCorrelationID());
  setJMSDeliveryMode(Integer.valueOf(message.getJMSDeliveryMode()));
  setJMSExpiration(Long.valueOf(message.getJMSExpiration()));
  setJMSMessageID(message.getJMSMessageID());
  setJMSPriority(Integer.valueOf(message.getJMSPriority()));
  setJMSRedelivered(Boolean.valueOf(message.getJMSRedelivered()));
  setJMSTimeStamp(Long.valueOf(message.getJMSTimestamp()));
  setJMSType(message.getJMSType());
  setSOAPJMSTargetService(message.getStringProperty(JMSSpecConstants.TARGETSERVICE_FIELD));
  setSOAPJMSBindingVersion(message.getStringProperty(JMSSpecConstants.BINDINGVERSION_FIELD));
  setSOAPJMSContentType(message.getStringProperty(JMSSpecConstants.CONTENTTYPE_FIELD));
  setSOAPJMSContentEncoding(message.getStringProperty(JMSSpecConstants.CONTENTENCODING_FIELD));
  setSOAPJMSSOAPAction(message.getStringProperty(JMSSpecConstants.SOAPACTION_FIELD));
  if (message.propertyExists(JMSSpecConstants.ISFAULT_FIELD)) {
    setSOAPJMSIsFault(message.getBooleanProperty(JMSSpecConstants.ISFAULT_FIELD));
  }
  setSOAPJMSRequestURI(message.getStringProperty(JMSSpecConstants.REQUESTURI_FIELD));
  setJMSReplyTo(getDestName(message));
  readProperties(message);
}

相关文章