-
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MVP proposal #28
base: master
Are you sure you want to change the base?
MVP proposal #28
Conversation
…ber) at project level
@lsfera, could you expand the requirement for URN mapping requirement? I think that I'm not fully following that part. Some examples showing the most basic and recommended way would help. I wouldn't like to have forced users to add marker attributes. Also, would it be possible to break this PR into smaller bits? It'd be easier to follow and understand the whole reasoning. |
URN mapping is required only if you want to limit interception of outboxed data to a narrower set.
None of the above requires deserialization from subscriber nor A POCO class - just a placeholder to enable attribute decoration. In case you want to deserialize your object - e.g.: in process transformation - you need to provide specific decoration via the MessageRoutedByUrnAttribute and use the Consumes<> method. I provided testing for almost any aspect discussed - they use the default (concise) configuration, Let me know if I was clear enough.
This is a bit harder. |
This PR covers all basic usage I was able to think about.
Messages are always stored in PostgreSql jsonb data type, hence publisher process is constrained on json serialization.
Consuming messages is instead more flexible since we are able to read data as string, object, or stream.
The former require subscriber(s) to subscribe publication(s) through one of the prefixed ConsumesRaw( String<>|Object<>| Strings | Objects ) methods.
The generics version require the RawUrn attributes to decorate the POCO class( no body required here, since it's nothing but a placeholder). RawUrn Urn property will be used to constraint publication creation, providing the row filter where clause(*).
Since we need to conform to a common standard shared by producer and consumer, the only supported NamingPolicy for this use case is the AttributeNamingPolicy - must be used on publication side.
The plural versions ConsumesRawStrings and ConsumesRawObjects won't provide any filter on publication, thus providing a single message sink for all published data.
Last but not least the Consumes<> subscription method provides the hook to the generics IHandle interface.
jsonb message data are read as stream and desarialised as T using System.Text.Json.JsonSerializer through the (mandatory) JsonSerializerContext.
Message table creation is enforced at subscription time ( but can also be assured at publication time) and support a few customization on column names/size see related tests.
(*) Remark Publication and subscription are managed by subscriber process.