GH-422, GH-606 Add support for generating attributes using provider in Consumer

This commit is contained in:
Oleg Zhurakousky
2020-11-16 16:27:54 +01:00
parent 1a6e9d4a80
commit 8993a9751f
3 changed files with 58 additions and 7 deletions

View File

@@ -286,6 +286,12 @@ public final class CloudEventMessageUtils {
}
}
public static CloudEventAttributes generateAttributesWithProvider(MessageHeaders headers, CloudEventAttributesProvider provider) {
CloudEventAttributes attributes = new CloudEventAttributes(headers);
provider.generateDefaultCloudEventHeaders(attributes);
return attributes;
}
public static CloudEventAttributes generateAttributes(Message<?> inputMessage, Object result, String applicationName) {
CloudEventAttributes attributes = new CloudEventAttributes(inputMessage.getHeaders(), CloudEventMessageUtils.determinePrefixToUse(inputMessage));
if (attributes.isValidCloudEvent()) {