Org springframework jms support converter messageconverter




















This is not to be confused with a JSON property which may be used alternatively and must be configured with Jackson-based annotations e. I'm using Spring Boot JmsTemplate and the 2nd class of Danylo Zatorsky's answer didn't quite work for me as its deserialization only returns simple strings. Prepending the content with the class name during serialization and cracking that out later with a regex allows one to reverse more complex objects.

Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams?

Collectives on Stack Overflow. Learn more. Caused by: org. Asked 4 years, 5 months ago. Active 1 year ago. Viewed 16k times. TEXT ; converter. Imran Imran 1, 1 1 gold badge 17 17 silver badges 43 43 bronze badges. Add a comment. Active Oldest Votes. Danylo Zatorsky Danylo Zatorsky 5, 2 2 gold badges 23 23 silver badges 44 44 bronze badges. Seems like that solved the problem. Thanks you. Not sure why the docs and samples have such a problematic approach without any proper explanation.

The java doc for set typeIdPropertyName just says type id property for the message. It must be set. But does not say how it should be set. Zwakele Mgabhi I had the same question. Pavel I used "org. MessageConverter" — Zwakele Mgabhi. MattC MattC 5, 1 1 gold badge 43 43 silver badges 37 37 bronze badges.

Michail Alexakis Michail Alexakis 5 5 silver badges 8 8 bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook. By default, the SimpleMessageConverter is used by the framework. We start from a previous Spring with JMS example. We will not use it and create our own custom implementation instead. First, we define a simple Person class that contains a name and age. You need to implement two methods: toMessage and fromMessage. These specify how the conversion between the Person object and JMS message is done.

In the toMessage method we create a TextMessage. Annotate the class with Component so that Spring registers the class as a Bean. To test the message converter, create a Person and send it to the converter. If you would like to run the above code sample you can get the full source code here. The best part? What is a Message Converter? JMSException ; import javax. Message ; import javax. Session ; import javax.



0コメント

  • 1000 / 1000