本文整理了Java中javax.jms.Message.setJMSPriority()
方法的一些代码示例,展示了Message.setJMSPriority()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.setJMSPriority()
方法的具体详情如下:
包路径:javax.jms.Message
类名称:Message
方法名:setJMSPriority
[英]Sets the priority level for this message.
This method is for use by JMS providers only to set this field when a message is sent. This message cannot be used by clients to configure the priority level of the message. This method is public to allow a JMS provider to set this field when sending a message whose implementation is not its own.
[中]设置此消息的优先级。
此方法仅供JMS提供程序在发送消息时用于设置此字段。客户端无法使用此消息配置消息的优先级。此方法是公共的,允许JMS提供程序在发送非其自身实现的消息时设置此字段。
代码示例来源:origin: apache/nifi
message.setJMSExpiration(Integer.parseInt(entry.getValue()));
} else if (entry.getKey().equals(JmsHeaders.PRIORITY)) {
message.setJMSPriority(Integer.parseInt(entry.getValue()));
} else if (entry.getKey().equals(JmsHeaders.REDELIVERED)) {
message.setJMSRedelivered(Boolean.parseBoolean(entry.getValue()));
代码示例来源:origin: spring-projects/spring-framework
@Test
public void jmsPriorityMappedToHeader() throws JMSException {
int priority = 8;
javax.jms.Message jmsMessage = new StubTextMessage();
jmsMessage.setJMSPriority(priority);
assertInboundHeader(jmsMessage, JmsHeaders.PRIORITY, priority);
}
代码示例来源:origin: apache/nifi
message.setJMSPriority(priority);
代码示例来源:origin: apache/activemq
/**
* Copies the standard JMS and user defined properties from the givem
* message to the specified message
*
* @param fromMessage the message to take the properties from
* @param toMessage the message to add the properties to
* @throws JMSException
*/
public static void copyProperties(Message fromMessage, Message toMessage) throws JMSException {
toMessage.setJMSMessageID(fromMessage.getJMSMessageID());
toMessage.setJMSCorrelationID(fromMessage.getJMSCorrelationID());
toMessage.setJMSReplyTo(transformDestination(fromMessage.getJMSReplyTo()));
toMessage.setJMSDestination(transformDestination(fromMessage.getJMSDestination()));
toMessage.setJMSDeliveryMode(fromMessage.getJMSDeliveryMode());
toMessage.setJMSRedelivered(fromMessage.getJMSRedelivered());
toMessage.setJMSType(fromMessage.getJMSType());
toMessage.setJMSExpiration(fromMessage.getJMSExpiration());
toMessage.setJMSPriority(fromMessage.getJMSPriority());
toMessage.setJMSTimestamp(fromMessage.getJMSTimestamp());
Enumeration propertyNames = fromMessage.getPropertyNames();
while (propertyNames.hasMoreElements()) {
String name = propertyNames.nextElement().toString();
Object obj = fromMessage.getObjectProperty(name);
toMessage.setObjectProperty(name, obj);
}
}
}
代码示例来源:origin: apache/activemq
message.setJMSPriority(priority);
message.setJMSRedelivered(false);
代码示例来源:origin: wildfly/wildfly
jmsMessage.setJMSPriority(priority);
代码示例来源:origin: spring-projects/spring-integration
@Test
public void testJmsPriorityMappedToHeader() throws JMSException {
javax.jms.Message jmsMessage = new StubTextMessage();
jmsMessage.setJMSPriority(5);
DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper();
Map<String, Object> headers = mapper.toHeaders(jmsMessage);
Object attrib = headers.get(IntegrationMessageHeaderAccessor.PRIORITY);
assertNotNull(attrib);
assertEquals(5, attrib);
}
代码示例来源:origin: spring-projects/spring-integration
@Test
public void testJmsPriorityNotMappedToHeader() throws JMSException {
javax.jms.Message jmsMessage = new StubTextMessage();
jmsMessage.setJMSPriority(5);
DefaultJmsHeaderMapper mapper = new DefaultJmsHeaderMapper();
mapper.setMapInboundPriority(false);
Map<String, Object> headers = mapper.toHeaders(jmsMessage);
Object attrib = headers.get(IntegrationMessageHeaderAccessor.PRIORITY);
assertNull(attrib);
}
代码示例来源:origin: org.apache.tomee/openejb-core
@Override
public void setJMSPriority(final int priority) throws JMSException {
message.setJMSPriority(priority);
}
代码示例来源:origin: org.jboss.jbossas/jboss-as-connector
public void setJMSPriority(int priority) throws JMSException
{
message.setJMSPriority(priority);
}
代码示例来源:origin: org.jboss.genericjms/generic-jms-ra-jar
public void setJMSPriority(int priority) throws JMSException {
message.setJMSPriority(priority);
}
代码示例来源:origin: org.apache.qpid/qpid-jca
/**
* Set priority
* @param priority The value
* @exception JMSException Thrown if an error occurs
*/
public void setJMSPriority(final int priority) throws JMSException
{
if (_log.isTraceEnabled())
{
_log.trace("setJMSPriority(" + priority + ")");
}
_message.setJMSPriority(priority);
}
代码示例来源:origin: apache/activemq-artemis
/**
* Set priority
*
* @param priority The value
* @throws JMSException Thrown if an error occurs
*/
@Override
public void setJMSPriority(final int priority) throws JMSException {
if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
ActiveMQRALogger.LOGGER.trace("setJMSPriority(" + priority + ")");
}
message.setJMSPriority(priority);
}
代码示例来源:origin: org.apache.activemq/artemis-ra
/**
* Set priority
*
* @param priority The value
* @throws JMSException Thrown if an error occurs
*/
@Override
public void setJMSPriority(final int priority) throws JMSException {
if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
ActiveMQRALogger.LOGGER.trace("setJMSPriority(" + priority + ")");
}
message.setJMSPriority(priority);
}
代码示例来源:origin: org.hornetq/hornetq-jms
public void send(final Message message) throws JMSException
{
checkClosed();
message.setJMSDeliveryMode(defaultDeliveryMode);
message.setJMSPriority(defaultPriority);
doSend(message, defaultTimeToLive, null);
}
代码示例来源:origin: org.hornetq/hornetq-jms
public void send(final Message message, final int deliveryMode, final int priority, final long timeToLive) throws JMSException
{
checkClosed();
message.setJMSDeliveryMode(deliveryMode);
message.setJMSPriority(priority);
doSend(message, timeToLive, null);
}
代码示例来源:origin: org.hornetq/hornetq-jms
public void send(final Destination destination, final Message message) throws JMSException
{
checkClosed();
if (destination != null && !(destination instanceof HornetQDestination))
{
throw new InvalidDestinationException("Not a HornetQ Destination:" + destination);
}
message.setJMSDeliveryMode(defaultDeliveryMode);
message.setJMSPriority(defaultPriority);
doSend(message, defaultTimeToLive, (HornetQDestination)destination);
}
代码示例来源:origin: timewalker74/ffmq
protected final void setupMessage( Destination destinationRef , Message message , int deliveryMode , int priority , long timeToLive) throws JMSException
{
long now = System.currentTimeMillis();
// Setup headers
message.setJMSMessageID(uuidProvider.getUUID());
message.setJMSTimestamp(disableMessageTimestamp ? 0 : now);
message.setJMSDeliveryMode(deliveryMode);
message.setJMSPriority(priority);
message.setJMSExpiration(timeToLive > 0 ? timeToLive+now : 0);
message.setJMSDestination(destinationRef);
}
代码示例来源:origin: org.hornetq/hornetq-jms
public void send(final Destination destination,
final Message message,
final int deliveryMode,
final int priority,
final long timeToLive) throws JMSException
{
checkClosed();
if (destination != null && !(destination instanceof HornetQDestination))
{
throw new InvalidDestinationException("Not a HornetQ Destination:" + destination);
}
message.setJMSDeliveryMode(deliveryMode);
message.setJMSPriority(priority);
doSend(message, timeToLive, (HornetQDestination)destination);
}
代码示例来源:origin: org.ballerinalang/ballerina-jms
@Override
public void execute(Context context, CallableUnitCallback callableUnitCallback) {
Struct messageStruct = BallerinaAdapter.getReceiverObject(context);
Message message = BallerinaAdapter.getNativeObject(messageStruct,
Constants.JMS_MESSAGE_OBJECT,
Message.class,
context);
int value = (int) context.getIntArgument(0);
try {
message.setJMSPriority(value);
} catch (JMSException e) {
BallerinaAdapter.returnError("Error when setting priority", context, e);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!