使用带有Spring REST端点的javax.jms.Message对象?

时间:2019-01-23 00:10:04

标签: java spring rest jms

我用Spring编写了以下REST端点:

@RequestMapping(value="/rest/endPoint", method=HttpMethod.POST)
public void handleMessage(@RequestBody Message message )
{
     //do some stuff with the Message
}

将通过JMS MessageListener类中的RestTemplate调用:

public class MyMessageListener implements MessageListener {
      @Autowired
      RestTemplate restTemplate;

      @Override
      public void onMessage(Message message)
      {
          restTemplate.exchange('/rest/endPoint', HttpMethod.POST, message );
      }
}

但是,当我运行此代码时,出现错误:

JSON parse error. Cannot construct an instance of 'javax.jms.Message'(no creators like, default constructor' exist...'

如何通过REST端点获取JMS消息?

0 个答案:

没有答案