List of usage examples for javax.jms Message DEFAULT_PRIORITY
int DEFAULT_PRIORITY
To view the source code for javax.jms Message DEFAULT_PRIORITY.
Click Source Link
From source file:org.apache.flink.streaming.connectors.jms.JmsQueueSink.java
@Override public void invoke(final T object) throws Exception { try {//w w w.j a va 2s. co m producer.send(destination, convert(object, session), Message.DEFAULT_DELIVERY_MODE, Message.DEFAULT_PRIORITY, Message.DEFAULT_TIME_TO_LIVE); } catch (JMSException e) { logger.error("Error sending message to [{}]: {}", destination.getQueueName(), e.getLocalizedMessage()); throw new UncategorizedJmsException(e); } }
From source file:org.apache.flink.streaming.connectors.jms.JmsTopicSink.java
@Override public void invoke(final T object) throws Exception { try {// ww w. j a v a 2 s .c o m producer.publish(destination, convert(object, session), Message.DEFAULT_DELIVERY_MODE, Message.DEFAULT_PRIORITY, Message.DEFAULT_TIME_TO_LIVE); } catch (JMSException e) { logger.error("Error sending message to [{}]: {}", destination.getTopicName(), e.getLocalizedMessage(), e); throw new UncategorizedJmsException(e); } }
From source file:net.timewalker.ffmq4.admin.RemoteAdministrationThread.java
@Override public void run() { log.info("Starting remote administration thread ..."); try {//from ww w . j ava 2 s .co m LocalQueue inputQueue = engine.getLocalQueue(FFMQConstants.ADM_REQUEST_QUEUE); LocalQueue outputQueue = engine.getLocalQueue(FFMQConstants.ADM_REPLY_QUEUE); conn = new LocalQueueConnection(engine, null, null); session = conn.createQueueSession(true, Session.SESSION_TRANSACTED); receiver = session.createReceiver(inputQueue); sender = session.createSender(outputQueue); conn.start(); // Flush input queue on startup inputQueue.purge(null); outputQueue.purge(null); // Enter listening loop notifyStartup(); while (!stopRequired) { Message message = receiver.receive(); if (message == null) break; // Interrupted log.debug("Received message " + message); try { // Process the command String errorMsg = process(message); // Build response message Message response = session.createMessage(); response.setJMSCorrelationID(message.getJMSMessageID()); if (errorMsg != null) response.setStringProperty(FFMQAdminConstants.ADM_HEADER_ERRMSG, errorMsg); sender.send(response, DeliveryMode.NON_PERSISTENT, Message.DEFAULT_PRIORITY, Message.DEFAULT_TIME_TO_LIVE); } catch (JMSException e) { log.error("Cannot process admin command", e); } finally { session.commit(); } } log.debug("Remote administration thread has stopped"); } catch (Throwable e) { log.fatal("Administration thread failed", e); notifyStartup(); } finally { try { if (sender != null) sender.close(); } catch (JMSException e) { ErrorTools.log(e, log); } try { if (receiver != null) receiver.close(); } catch (JMSException e) { ErrorTools.log(e, log); } try { if (session != null) session.close(); } catch (JMSException e) { ErrorTools.log(e, log); } try { if (conn != null) conn.close(); } catch (JMSException e) { ErrorTools.log(e, log); } } }
From source file:org.apache.qpid.disttest.controller.config.ProducerConfig.java
public ProducerConfig() { _deliveryMode = Message.DEFAULT_DELIVERY_MODE; _messageSize = 1024;//w ww . j a v a 2 s . c om _priority = Message.DEFAULT_PRIORITY; _timeToLive = Message.DEFAULT_TIME_TO_LIVE; _interval = 0; _startDelay = 0; _messageProviderName = null; }
From source file:org.apache.rocketmq.jms.RocketMQProducer.java
/** * Init the JmsMessage Headers.//from w w w.ja v a2s .c o m * <p/> * <P>JMS providers init message's headers. Do not allow user to set these by yourself. * * @param rmqJmsMsg message * @param destination * @throws javax.jms.JMSException * @see <CODE>Destination</CODE> */ private void initJMSHeaders(RocketMQMessage rmqJmsMsg, Destination destination) throws JMSException { //JMS_DESTINATION default:"topic:message" rmqJmsMsg.setHeader(JMS_DESTINATION, destination); //JMS_DELIVERY_MODE default : PERSISTENT rmqJmsMsg.setHeader(JMS_DELIVERY_MODE, javax.jms.Message.DEFAULT_DELIVERY_MODE); //JMS_TIMESTAMP default : current time rmqJmsMsg.setHeader(JMS_TIMESTAMP, System.currentTimeMillis()); //JMS_EXPIRATION default : 3 days //JMS_EXPIRATION = currentTime + time_to_live rmqJmsMsg.setHeader(JMS_EXPIRATION, System.currentTimeMillis() + DEFAULT_TIME_TO_LIVE); //JMS_PRIORITY default : 4 rmqJmsMsg.setHeader(JMS_PRIORITY, javax.jms.Message.DEFAULT_PRIORITY); //JMS_TYPE default : ons(open notification service) rmqJmsMsg.setHeader(JMS_TYPE, DEFAULT_JMS_TYPE); //JMS_REPLY_TO,JMS_CORRELATION_ID default : null //JMS_MESSAGE_ID is set by sendResult. //JMS_REDELIVERED is set by broker. }
From source file:org.apache.synapse.message.store.impl.jms.JmsProducer.java
private void setPriority(javax.jms.MessageProducer producer, ObjectMessage objectMessage, StorableMessage message) {//from w w w .j a va 2 s .com if (message.getPriority(DEFAULT_PRIORITY) != Message.DEFAULT_PRIORITY) { try { producer.setPriority(message.getPriority(DEFAULT_PRIORITY)); } catch (JMSException e) { logger.warn(getId() + " could not set priority [" + message.getPriority(DEFAULT_PRIORITY) + "]"); } } else { try { producer.setPriority(Message.DEFAULT_PRIORITY); } catch (JMSException e) { } } }
From source file:org.apache.synapse.message.store.impl.jms.JmsProducer.java
private void setJmsProducerProperties(javax.jms.MessageProducer producer, MessageContext synCtx) { Object prop = synCtx.getProperty(JMS_PROD_TIME_TO_LIVE); long ttl = Message.DEFAULT_TIME_TO_LIVE; if (prop instanceof String) { ttl = Long.parseLong((String) prop); } else if (prop instanceof Long || prop instanceof Integer) { ttl = Long.parseLong(prop.toString()); }//w ww. j av a 2s.c om prop = synCtx.getProperty(JMS_PROD_DISABLE_MSG_TIMESTAMP); boolean disableMessageTimestamp = false; if (prop instanceof String) { disableMessageTimestamp = Boolean.parseBoolean((String) prop); } else if (prop instanceof Boolean) { disableMessageTimestamp = (Boolean) prop; } prop = synCtx.getProperty(JMS_PROD_DELIVERY_MODE); int deliveryMode = Message.DEFAULT_DELIVERY_MODE; if (prop instanceof Integer) { deliveryMode = (Integer) prop; } else if (prop instanceof String) { deliveryMode = Integer.parseInt((String) prop); } prop = synCtx.getProperty(JMS_PROD_DISABLE_MSG_ID); boolean disableMessageId = false; if (prop instanceof String) { disableMessageId = Boolean.parseBoolean((String) prop); } else if (prop instanceof Boolean) { disableMessageId = (Boolean) prop; } prop = synCtx.getProperty(JMS_PROD_PRIORITY); int priority = Message.DEFAULT_PRIORITY; if (prop instanceof Integer) { priority = (Integer) prop; } else if (prop instanceof String) { priority = Integer.parseInt((String) prop); } try { producer.setTimeToLive(ttl); producer.setDisableMessageTimestamp(disableMessageTimestamp); producer.setDeliveryMode(deliveryMode); producer.setDisableMessageID(disableMessageId); producer.setPriority(priority); } catch (JMSException e) { if (logger.isDebugEnabled()) { logger.debug("Could not save Producer property: " + e.getLocalizedMessage()); } } }
From source file:org.dcm4chex.archive.hsm.FileMoveService.java
protected void schedule(DeleteStudyOrder order, long scheduledTime) throws Exception { if (srcFsGroup == null || destFsGroup == null) { String msg = "FileMove service is disabled! Set SourceFileSystemGroupID and DestinationFileSystemGroupID to enable it."; log.info(msg);//from www . j a v a 2 s. c om throw new RuntimeException(msg); } else if ("ERROR".equals(getUsableDiskSpaceStringOnDest())) { String msg = "UsableDiskSpaceStringOnDest reports an error! Scheduling Move Order cancelled! Please check DestinationFileSystemGroupID configuration!"; log.error(msg); throw new RuntimeException(msg); } else { if (log.isInfoEnabled()) { String scheduledTimeStr = scheduledTime > 0 ? new Date(scheduledTime).toString() : "now"; log.info("Scheduling job [" + order + "] at " + scheduledTimeStr + ". Retry times: " + order.getFailureCount()); } jmsDelegate.queue(moveFilesOfStudyQueueName, order, Message.DEFAULT_PRIORITY, scheduledTime); } }
From source file:org.mule.transport.jms.Jms11Support.java
public void send(MessageProducer producer, Message message, boolean topic, ImmutableEndpoint endpoint) throws JMSException { send(producer, message, connector.isPersistentDelivery(), Message.DEFAULT_PRIORITY, Message.DEFAULT_TIME_TO_LIVE, topic, endpoint); }
From source file:org.mule.transport.jms.Jms11Support.java
public void send(MessageProducer producer, Message message, Destination dest, boolean topic, ImmutableEndpoint endpoint) throws JMSException { send(producer, message, dest, connector.isPersistentDelivery(), Message.DEFAULT_PRIORITY, Message.DEFAULT_TIME_TO_LIVE, topic, endpoint); }