I want to send a large string message (3-5 MB) with jmstemplate (with activemq jms broker). In the middle of sending the message, i shutdowned my broker; Why i can't catch throwed exception in catch(Exception e)? What should i do to handle this exception?
public class MessageSenderServiceImpl implements MessageSenderService
{
private JmsTemplate jmsTemplate;
@Override
@Transactional
public void sendMessage(final String messageContent, final String destination) throws SendingMessageException
{
try
{
jmsTemplate.send(destination, new MessageCreator()
{
@Override
public Message createMessage(Session session) throws JMSException
{
BytesMessage byteMessage = session.createBytesMessage();
try
{
byteMessage.writeBytes(messageContent.getBytes("UTF-8"));
return byteMessage;
}
catch (UnsupportedEncodingException e)
{
e.printStackTrace();
throw new JMSException(e.getMessage());
}
}
});
}
catch(Exception e)
{
throw new SendingMessageException(e.getMessage(),e);
}
}
public void setJmsTemplate(JmsTemplate jmsTemplate)
{
this.jmsTemplate = jmsTemplate;
}
}
thanks in advance.