本文整理汇总了Java中org.springframework.jms.core.MessagePostProcessor类的典型用法代码示例。如果您正苦于以下问题:Java MessagePostProcessor类的具体用法?Java MessagePostProcessor怎么用?Java MessagePostProcessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MessagePostProcessor类属于org.springframework.jms.core包,在下文中一共展示了MessagePostProcessor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendNewFiles
import org.springframework.jms.core.MessagePostProcessor; //导入依赖的package包/类
/**
* Sends all files in directory to broker
*
* @param directory where files can be found
* @param hasError if the reaction/aggregation ended with an error
*/
public void sendNewFiles(File directory, boolean hasError){
String messageText = createMessageText(hasError, directory);
jmsTemplate.convertAndSend(productQueue, messageText,
new MessagePostProcessor() {
public Message postProcessMessage(Message message) {
try {
message.setJMSCorrelationID(directory.getName());
} catch (JMSException e) {
e.printStackTrace();
}
return message;
}
});
}
示例2: errorDuringMsg
import org.springframework.jms.core.MessagePostProcessor; //导入依赖的package包/类
public void errorDuringMsg(final Map msg, Throwable t, final String lvl) {
try {
getJmsTemplate().convertAndSend(MessageDestinations.DEAD_LETTER_QUEUE, SyncMessageUtils.createErrorMessage(msg, t, lvl), new MessagePostProcessor() {
@Override
public Message postProcessMessage(Message message) throws JMSException {
message.setStringProperty(PATIENT_ID, (String) msg.get(PATIENT_ID)); // this enables us to select messages from the queue by pid
message.setStringProperty(ERROR_LEVEL, lvl);
return message;
}
});
Object msgPid = msg.get(SyncMessageConstants.PATIENT_ID);
if(msgPid!=null) {
// FIXME: move this into metadata rather than on demographics object
PatientDemographics pat = patientDao.findByPid(msg.get(SyncMessageConstants.PATIENT_ID).toString());
if(pat!=null) {
pat.incrementSyncErrorCount();
patientDao.save(pat);
}
}
} catch (JmsException e) {
Object pid = msg.get(SyncMessageConstants.PATIENT_ID);
String pidString = pid == null ? "" : String.valueOf(pid);
log.error("unable to put error msg in error queue: " + t.getMessage() + "\n" + pidString, e);
}
}
示例3: send
import org.springframework.jms.core.MessagePostProcessor; //导入依赖的package包/类
@Override
public void send(final T dto) throws Exception {
this.getTemplatePublisher().convertAndSend(dto,
new MessagePostProcessor() {
@Override
public Message postProcessMessage(final Message message)
throws JMSException {
if (logger.isDebugEnabled())
{
logger.debug("***** SENDING MESSAGE ******");
traceMessage(message);
}
return message;
}
});
}
示例4: testStringProperty
import org.springframework.jms.core.MessagePostProcessor; //导入依赖的package包/类
@Test
public void testStringProperty() throws JMSException {
MessagePostProcessor processor = createProcessor("key", "value");
Message message = mock(Message.class);
processor.postProcessMessage(message);
verify(message).setStringProperty("key", "value");
}
示例5: testIntProperty
import org.springframework.jms.core.MessagePostProcessor; //导入依赖的package包/类
@Test
public void testIntProperty() throws JMSException {
MessagePostProcessor processor = createProcessor("key", 1);
Message message = mock(Message.class);
processor.postProcessMessage(message);
verify(message).setIntProperty("key", 1);
}
示例6: testLongProperty
import org.springframework.jms.core.MessagePostProcessor; //导入依赖的package包/类
@Test
public void testLongProperty() throws JMSException {
MessagePostProcessor processor = createProcessor("key", 1L);
Message message = mock(Message.class);
processor.postProcessMessage(message);
verify(message).setLongProperty("key", 1L);
}
示例7: testShortProperty
import org.springframework.jms.core.MessagePostProcessor; //导入依赖的package包/类
@Test
public void testShortProperty() throws JMSException {
MessagePostProcessor processor = createProcessor("key", (short) 1);
Message message = mock(Message.class);
processor.postProcessMessage(message);
verify(message).setShortProperty("key", (short) 1);
}
示例8: testByteProperty
import org.springframework.jms.core.MessagePostProcessor; //导入依赖的package包/类
@Test
public void testByteProperty() throws JMSException {
MessagePostProcessor processor = createProcessor("key", (byte) 1);
Message message = mock(Message.class);
processor.postProcessMessage(message);
verify(message).setByteProperty("key", (byte) 1);
}
示例9: testBooleanProperty
import org.springframework.jms.core.MessagePostProcessor; //导入依赖的package包/类
@Test
public void testBooleanProperty() throws JMSException {
MessagePostProcessor processor = createProcessor("key", true);
Message message = mock(Message.class);
processor.postProcessMessage(message);
verify(message).setBooleanProperty("key", true);
}
示例10: testFloatProperty
import org.springframework.jms.core.MessagePostProcessor; //导入依赖的package包/类
@Test
public void testFloatProperty() throws JMSException {
MessagePostProcessor processor = createProcessor("key", (float) 1.5);
Message message = mock(Message.class);
processor.postProcessMessage(message);
verify(message).setFloatProperty("key", (float) 1.5);
}
示例11: testObjectProperty
import org.springframework.jms.core.MessagePostProcessor; //导入依赖的package包/类
@Test
public void testObjectProperty() throws JMSException {
Object object = new Object();
MessagePostProcessor processor = createProcessor("key", object);
Message message = mock(Message.class);
processor.postProcessMessage(message);
verify(message).setObjectProperty("key", object);
}
示例12: onApplicationEvent
import org.springframework.jms.core.MessagePostProcessor; //导入依赖的package包/类
@Override
public void onApplicationEvent(ApplicationEvent applicationEvent) {
if (applicationEvent instanceof ContextRefreshedEvent) {
final String destinationName = "srs.release-build";
messagingHelper.getJmsTemplate().convertAndSend(destinationName, "", new MessagePostProcessor() {
@Override
public Message postProcessMessage(Message message) throws JMSException {
message.setStringProperty(MessagingHelper.AUTHENTICATION_TOKEN, "");
message.setStringProperty(BuildTriggerMessageHandler.RELEASE_CENTER_KEY, "rc");
message.setStringProperty(BuildTriggerMessageHandler.PRODUCT_KEY, "prod");
message.setStringProperty(BuildTriggerMessageHandler.BUILD_ID, "build");
return message;
}
});
}
}
示例13: warningDuringMsg
import org.springframework.jms.core.MessagePostProcessor; //导入依赖的package包/类
public void warningDuringMsg(final Map msg, String warning) {
getJmsTemplate().convertAndSend(MessageDestinations.WARNING_QUEUE, SyncMessageUtils.createWarningMessage(msg, warning), new MessagePostProcessor() {
@Override
public Message postProcessMessage(Message message) throws JMSException {
message.setStringProperty(PATIENT_ID, (String) msg.get(PATIENT_ID)); // this enables us to select messages from the queue by pid
return message;
}
});
}
示例14: sendErrorMessage
import org.springframework.jms.core.MessagePostProcessor; //导入依赖的package包/类
private void sendErrorMessage(final Map<String, Object> msg, Throwable t) {
final String pid = (String) msg.get(SyncMessageConstants.PATIENT_ID);
jms.convertAndSend(MessageDestinations.ERROR_QUEUE, SyncMessageUtils.createErrorMessage(msg, t, ErrorLevel.ERROR), new MessagePostProcessor() {
@Override
public Message postProcessMessage(Message message) throws JMSException {
message.setStringProperty(SyncMessageConstants.PATIENT_ID, pid);
return message;
}
});
}
示例15: testDoubleProperty
import org.springframework.jms.core.MessagePostProcessor; //导入依赖的package包/类
@Test
public void testDoubleProperty() throws JMSException {
MessagePostProcessor processor = createProcessor("key", 1.5);
Message message = mock(Message.class);
processor.postProcessMessage(message);
verify(message).setDoubleProperty("key", 1.5);
}