本文整理汇总了Java中org.springframework.jms.support.JmsUtils.convertJmsAccessException方法的典型用法代码示例。如果您正苦于以下问题:Java JmsUtils.convertJmsAccessException方法的具体用法?Java JmsUtils.convertJmsAccessException怎么用?Java JmsUtils.convertJmsAccessException使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.jms.support.JmsUtils
的用法示例。
在下文中一共展示了JmsUtils.convertJmsAccessException方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ReceiveMessage
import org.springframework.jms.support.JmsUtils; //导入方法依赖的package包/类
@Override
public byte[] ReceiveMessage(Destination destination, long timeout) {
byte[] msg = null;
jmsTemplate.setReceiveTimeout(timeout);
Message message = jmsTemplate.receive(destination);
try {
if (message instanceof TextMessage) {
msg = ((TextMessage) message).getText().getBytes();
} else if (message instanceof BytesMessage) {
BytesMessage bMsg = (BytesMessage) message;
msg = new byte[(int) bMsg.getBodyLength()];
bMsg.readBytes(msg);
} else if (message instanceof ObjectMessage) {
ObjectMessage oMsg = (ObjectMessage) message;
msg = (byte[]) oMsg.getObject();
}
} catch (JMSException e) {
throw JmsUtils.convertJmsAccessException(e);
}
return msg;
}
示例2: leesBerichtReferentie
import org.springframework.jms.support.JmsUtils; //导入方法依赖的package包/类
private String leesBerichtReferentie(final Message message) {
try {
return message.getStringProperty(BERICHT_REFERENTIE);
} catch (final JMSException e) {
throw JmsUtils.convertJmsAccessException(e);
}
}
示例3: composeAntwoord
import org.springframework.jms.support.JmsUtils; //导入方法依赖的package包/类
<T> Message composeAntwoord(final T antwoord, final Session session) {
try {
final Message result = session.createTextMessage(serializer.serialiseerNaarString(antwoord));
result.setStringProperty(BERICHT_REFERENTIE, UUID.randomUUID().toString());
result.setStringProperty(CORRELATIE_REFERENTIE, getBerichtReferentie());
return result;
} catch (JMSException e) {
throw JmsUtils.convertJmsAccessException(e);
}
}
示例4: testExceptionStackTrace
import org.springframework.jms.support.JmsUtils; //导入方法依赖的package包/类
@Test
public void testExceptionStackTrace() {
JMSException jmsEx = new JMSException("could not connect");
Exception innerEx = new Exception("host not found");
jmsEx.setLinkedException(innerEx);
JmsException springJmsEx = JmsUtils.convertJmsAccessException(jmsEx);
StringWriter sw = new StringWriter();
PrintWriter out = new PrintWriter(sw);
springJmsEx.printStackTrace(out);
String trace = sw.toString();
assertTrue("inner jms exception not found", trace.indexOf("host not found") > 0);
}
示例5: getAlert
import org.springframework.jms.support.JmsUtils; //导入方法依赖的package包/类
public Spittle getAlert() {
try {
ObjectMessage receivedMessage =
(ObjectMessage) jmsTemplate.receive(); //<co id="co_receive"/>
return (Spittle) receivedMessage.getObject();//<co id="co_getObject"/>
} catch (JMSException jmsException) {
throw JmsUtils.convertJmsAccessException(jmsException);//<co id="co_throwException"/>
}
}
示例6: onMessage
import org.springframework.jms.support.JmsUtils; //导入方法依赖的package包/类
public void onMessage(Message message) {
if(message instanceof TextMessage) {
TextMessage textMessage = (TextMessage) message;
try {
String text = textMessage.getText();
System.out.println(String.format("Received: %s",text));
throw new JMSException("process failed");
} catch (JMSException e) {
System.out.println("there is JMS exception: " + e.getMessage() );
throw JmsUtils.convertJmsAccessException(e);
}
}
}