INT-3337: MongoDbMessageStore Refactoring
JIRA: https://jira.spring.io/browse/INT-3337 INT-3337: Addressing PR comments INT-3337: Add support to store/read Messages * Add support to store/read `ErrorMessage`. As a trick for `Throwable` is selected (de)serializing converter INT-3337: Add converters for `Message<?>` impls INT-3337: Make `MDbMS.MessageWrapper` AuditAware Add `_id` persistence field Addressing PR comments Polishing - Docs - Check for null ApplicationContext - Add afterPropertiesSet() to tests
This commit is contained in:
committed by
Gary Russell
parent
6d6bef58b2
commit
c11e3ba3b5
@@ -23,6 +23,7 @@ import org.springframework.integration.store.SimpleMessageStore;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageHeaders;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
@@ -34,6 +35,7 @@ import org.springframework.util.ObjectUtils;
|
||||
* a reference to the message and changes will be reflected there too.
|
||||
*
|
||||
* @author Gary Russell
|
||||
* @author Artem Bilan
|
||||
* @since 4.0
|
||||
*
|
||||
*/
|
||||
@@ -52,9 +54,10 @@ public class MutableMessage<T> implements Message<T>, Serializable {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public MutableMessage(T payload, MessageHeaders headers) {
|
||||
this.payload = payload;
|
||||
public MutableMessage(T payload, Map<String, Object> headers) {
|
||||
Assert.notNull(payload, "payload must not be null");
|
||||
this.headers = new MessageHeaders(headers);
|
||||
this.payload = payload;
|
||||
// Needs SPR-11468 to avoid DFA and header manipulation
|
||||
rawHeaders = (Map<String, Object>) new DirectFieldAccessor(this.headers)
|
||||
.getPropertyValue("headers");
|
||||
@@ -64,6 +67,7 @@ public class MutableMessage<T> implements Message<T>, Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MessageHeaders getHeaders() {
|
||||
return this.headers;
|
||||
@@ -75,6 +79,7 @@ public class MutableMessage<T> implements Message<T>, Serializable {
|
||||
}
|
||||
|
||||
public void setPayload(T payload) {
|
||||
Assert.notNull(payload, "'payload' must not be null");
|
||||
this.payload = payload;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user