Skip to content
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

Try to avoid reflection usage in IConsume #17

Open
oskardudycz opened this issue Jun 20, 2024 · 3 comments
Open

Try to avoid reflection usage in IConsume #17

oskardudycz opened this issue Jun 20, 2024 · 3 comments

Comments

@oskardudycz
Copy link
Collaborator

Per discussion: #7 (comment)

About: https://github.com/oskardudycz/PostgresOutboxPatternWithCDC.NET/blob/3d42e3552956cecfd1773e97a9afd0170ada0937/src/PostgresOutbox/Subscriptions/Subscription.cs#L138

@oskardudycz:

CONCERN: Is this used to call the generic method of the IConsume? If yes, then I'd recommend extending IConsume to have a method accepting an object message, then default implementation in IConsume that would call the typed method. This would reduce the need for this reflection access here, we could just call it.

@lsfera

We might support different scenario.
A truly confident user could simply decide to deal with raw data, hence a basic IConsume would be enough. Or he would rather prefer to work typed data and generics support, hence some sort of (memoized)reflections stuff should unavoidable. Some benchmark here might help in solving the dilemma of reflection adoption.

@lsfera
Copy link
Contributor

lsfera commented Jul 8, 2024

I'm working on a prototype the following these assumptions:

  • retain publication filter capability
  • allow mixin of different consuming strategies

The consumer code:
image

Here are the contracts:
image

The goal is to read jsonb as a string
image

or as an object

image

This way we should be able to address all use cases but binary format.

@oskardudycz
Copy link
Collaborator Author

Interesting. If you have some draft, I'm happy to take a look to learn more about that.

Also, FYI, from 13th July till the end of the month, I'm on vacation, and I plan to be offline to recharge a bit, but I plan to also do more work on Blumchen in August.

@lsfera
Copy link
Contributor

lsfera commented Jul 17, 2024

This summer I'm having shorter breaks - a week or less - every month so that kids have feelings of longer vacations... We'll see how effective this strategy works, but I can definitely say that it's exhausting :-;

I'm playing with this branch - https://github.com/lsfera/Postgresql.Outbox/tree/serialization - to cover more jsonb options skipping deserialization when not needed
Here's https://github.com/lsfera/Postgresql.Outbox/blob/serialization/src/Subscriber/Program.cs#L35-L39 how you can make use of new functionalities

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants