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

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

本文整理了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

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

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

  1. public boolean propertyExists(String name) throws JMSException
  2. {
  3. return message.propertyExists(name);
  4. }

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

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

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

  1. /**
  2. * Do property exist
  3. * @param name The name
  4. * @return The value
  5. * @exception JMSException Thrown if an error occurs
  6. */
  7. public boolean propertyExists(final String name) throws JMSException
  8. {
  9. if (_log.isTraceEnabled())
  10. {
  11. _log.trace("propertyExists(" + name + ")");
  12. }
  13. return _message.propertyExists(name);
  14. }

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

  1. public boolean propertyExists(String aKey) throws AsynchAEException {
  2. try {
  3. return message.propertyExists(aKey);
  4. } catch (Exception e) {
  5. throw new AsynchAEException(e);
  6. }
  7. }

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

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

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

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

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

  1. /**
  2. * Do property exist
  3. *
  4. * @param name The name
  5. * @return The value
  6. * @throws JMSException Thrown if an error occurs
  7. */
  8. @Override
  9. public boolean propertyExists(final String name) throws JMSException {
  10. if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
  11. ActiveMQRALogger.LOGGER.trace("propertyExists(" + name + ")");
  12. }
  13. return message.propertyExists(name);
  14. }

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

  1. protected boolean handleDelivery(Message msg)
  2. {
  3. int max = maxResent;
  4. try
  5. {
  6. if (msg.propertyExists(JMS_JBOSS_REDELIVERY_LIMIT))
  7. max = msg.getIntProperty(JMS_JBOSS_REDELIVERY_LIMIT);
  8. if (msg.propertyExists(JMS_JBOSS_REDELIVERY_COUNT))
  9. {
  10. int count = msg.getIntProperty(JMS_JBOSS_REDELIVERY_COUNT);
  11. if (count > max)
  12. {
  13. warnDLQ(msg, count, max);
  14. return true;
  15. }
  16. }
  17. }
  18. catch (Throwable t)
  19. {
  20. log.warn("Unexpected error retrieving message properties " + msg, t);
  21. }
  22. return false;
  23. }
  24. }

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

  1. /**
  2. * Do property exist
  3. *
  4. * @param name The name
  5. * @return The value
  6. * @throws JMSException Thrown if an error occurs
  7. */
  8. @Override
  9. public boolean propertyExists(final String name) throws JMSException {
  10. if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
  11. ActiveMQRALogger.LOGGER.trace("propertyExists(" + name + ")");
  12. }
  13. return message.propertyExists(name);
  14. }

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

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

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

  1. @Override
  2. public String getRelatedEventIdentifier(Message message) throws ManagedEventIdentifierException
  3. {
  4. try
  5. {
  6. if (message.propertyExists(ManagedRelatedEventIdentifierService.RELATED_EVENT_LIFE_ID))
  7. {
  8. return message.getStringProperty(ManagedRelatedEventIdentifierService.RELATED_EVENT_LIFE_ID);
  9. }
  10. else
  11. {
  12. return null;
  13. }
  14. }
  15. catch (JMSException e)
  16. {
  17. throw new ManagedEventIdentifierException("Failed to get " + ManagedRelatedEventIdentifierService.RELATED_EVENT_LIFE_ID + " from JMS message", e);
  18. }
  19. }
  20. }

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

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

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

  1. private void deserializeAndCompleteProcessingReply(String casReferenceId, Message message,
  2. ClientRequest cachedRequest, ProcessTrace pt, boolean doNotify) throws Exception {
  3. if (!running) {
  4. return;
  5. }
  6. int payload = ((Integer) message.getIntProperty(AsynchAEMessage.Payload)).intValue();
  7. if (message.propertyExists(AsynchAEMessage.CasSequence)) {
  8. handleProcessReplyFromCasMultiplier(message, casReferenceId, payload);// , cachedRequest);
  9. } else {
  10. long t1 = System.nanoTime();
  11. boolean deltaCas = false;
  12. if (message.propertyExists(AsynchAEMessage.SentDeltaCas)) {
  13. deltaCas = message.getBooleanProperty(AsynchAEMessage.SentDeltaCas);
  14. }
  15. CAS cas = null;
  16. if (message instanceof TextMessage) {
  17. cas = deserializeCAS(((TextMessage) message).getText(), cachedRequest, deltaCas);
  18. } else {
  19. long bodyLength = ((BytesMessage) message).getBodyLength();
  20. byte[] serializedCas = new byte[(int) bodyLength];
  21. ((BytesMessage) message).readBytes(serializedCas);
  22. cas = deserializeCAS(serializedCas, cachedRequest);
  23. }
  24. cachedRequest.setDeserializationTime(System.nanoTime() - t1);
  25. completeProcessingReply(cas, casReferenceId, payload, doNotify, message, cachedRequest, pt);
  26. }
  27. }

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

  1. protected void populateMessage(Message message, NormalizedMessage normalizedMessage) throws Exception {
  2. if (message instanceof TextMessage) {
  3. PhaseInterceptorChain chain = new PhaseInterceptorChain();
  4. chain.add(new AttachmentsInInterceptor());
  5. chain.add(new StaxInInterceptor());
  6. org.apache.servicemix.soap.api.Message msg = new MessageImpl();
  7. msg.setContent(InputStream.class, new ByteArrayInputStream(((TextMessage) message).getText().getBytes()));
  8. if (message.propertyExists(CONTENT_TYPE_PROPERTY)) {
  9. msg.put(org.apache.servicemix.soap.api.Message.CONTENT_TYPE, message.getStringProperty(CONTENT_TYPE_PROPERTY));
  10. }
  11. chain.doIntercept(msg);
  12. XMLStreamReader xmlReader = msg.getContent(XMLStreamReader.class);
  13. normalizedMessage.setContent(new StaxSource(xmlReader));
  14. for (Map.Entry<String, DataHandler> attachment : msg.getAttachments().entrySet()) {
  15. normalizedMessage.addAttachment(attachment.getKey(), attachment.getValue());
  16. }
  17. } else {
  18. throw new UnsupportedOperationException("JMS message is not a TextMessage");
  19. }
  20. }

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

  1. public void populateMessage(Message message, MessageExchange exchange, NormalizedMessage normalizedMessage) throws Exception {
  2. if (message instanceof TextMessage) {
  3. PhaseInterceptorChain chain = new PhaseInterceptorChain();
  4. chain.add(new AttachmentsInInterceptor());
  5. chain.add(new StaxInInterceptor());
  6. org.apache.servicemix.soap.api.Message msg = new MessageImpl();
  7. msg.setContent(InputStream.class, new ByteArrayInputStream(((TextMessage) message).getText().getBytes()));
  8. if (message.propertyExists(CONTENT_TYPE_PROPERTY)) {
  9. msg.put(org.apache.servicemix.soap.api.Message.CONTENT_TYPE, message.getStringProperty(CONTENT_TYPE_PROPERTY));
  10. }
  11. chain.doIntercept(msg);
  12. XMLStreamReader xmlReader = msg.getContent(XMLStreamReader.class);
  13. normalizedMessage.setContent(new StaxSource(xmlReader));
  14. for (Map.Entry<String, DataHandler> attachment : msg.getAttachments().entrySet()) {
  15. normalizedMessage.addAttachment(attachment.getKey(), attachment.getValue());
  16. }
  17. if (isCopyProperties()) {
  18. copyPropertiesFromJMS(message, normalizedMessage);
  19. }
  20. } else {
  21. throw new UnsupportedOperationException("JMS message is not a TextMessage");
  22. }
  23. }

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

  1. public WsJmsMessage jmsToSoap(final Message message, final JMSImplementation impl) throws JMSException {
  2. JMSMessageClassEnum messageType = JMSMessageClassEnum.UNSUPPORTED;
  3. for (final Map.Entry<Class<? extends Message>, JMSMessageClassEnum> entry : ENUM_BY_CLASS.entrySet()) {
  4. if (entry.getKey().isInstance(message)) {
  5. messageType = entry.getValue();
  6. }
  7. }
  8. final List<Headers> headers = convertHeaders(message);
  9. String clientId = null;
  10. if (JMSImplementation.ARTEMIS_ACTIVE_MQ.equals(impl)
  11. && message.propertyExists(SoapToJmsSerializer.ACTIVEMQ_DUPLICATE_ID)) {
  12. clientId = message.getStringProperty(SoapToJmsSerializer.ACTIVEMQ_DUPLICATE_ID);
  13. }
  14. final DataHandler bodyStream = extractBody(message, messageType);
  15. final WsJmsMessage wsmessage = new WsJmsMessage(headers, message.getJMSCorrelationID(),
  16. message.getJMSDeliveryMode(), message.getJMSDeliveryTime(), message.getJMSExpiration(), // expiration
  17. message.getJMSMessageID(), message.getJMSPriority(), message.getJMSRedelivered(), //
  18. message.getJMSTimestamp(), message.getJMSType(), //
  19. clientId, messageType.toString(), bodyStream);
  20. return wsmessage;
  21. }

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

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

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

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

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

  1. private void read(Message message) throws JMSException {
  2. setJMSCorrelationID(message.getJMSCorrelationID());
  3. setJMSDeliveryMode(Integer.valueOf(message.getJMSDeliveryMode()));
  4. setJMSExpiration(Long.valueOf(message.getJMSExpiration()));
  5. setJMSMessageID(message.getJMSMessageID());
  6. setJMSPriority(Integer.valueOf(message.getJMSPriority()));
  7. setJMSRedelivered(Boolean.valueOf(message.getJMSRedelivered()));
  8. setJMSTimeStamp(Long.valueOf(message.getJMSTimestamp()));
  9. setJMSType(message.getJMSType());
  10. setSOAPJMSTargetService(message.getStringProperty(JMSSpecConstants.TARGETSERVICE_FIELD));
  11. setSOAPJMSBindingVersion(message.getStringProperty(JMSSpecConstants.BINDINGVERSION_FIELD));
  12. setSOAPJMSContentType(message.getStringProperty(JMSSpecConstants.CONTENTTYPE_FIELD));
  13. setSOAPJMSContentEncoding(message.getStringProperty(JMSSpecConstants.CONTENTENCODING_FIELD));
  14. setSOAPJMSSOAPAction(message.getStringProperty(JMSSpecConstants.SOAPACTION_FIELD));
  15. if (message.propertyExists(JMSSpecConstants.ISFAULT_FIELD)) {
  16. setSOAPJMSIsFault(message.getBooleanProperty(JMSSpecConstants.ISFAULT_FIELD));
  17. }
  18. setSOAPJMSRequestURI(message.getStringProperty(JMSSpecConstants.REQUESTURI_FIELD));
  19. setJMSReplyTo(getDestName(message));
  20. readProperties(message);
  21. }

相关文章