Skip to content

Conversation

@Gsantomaggio
Copy link
Member

@Gsantomaggio Gsantomaggio commented Oct 1, 2024

Closes #71

  • Implement the SubscriptionListener, during the Consumer creation, like:
 IConsumer consumer = await _connection.ConsumerBuilder()
            .Queue("MyStream").MessageHandler(
                async (context, message) =>
                {
....
                 }
            ).Stream().Builder().SubscriptionListener(
                ctx => { 
                 /// here the offset 
                 ctx.StreamOptions.Offset(<<myoffset>>); 
            }
            ).BuildAndStartAsync();

The listener function is called each time the consumer is created, even during the restart.

Check this test StreamConsumerBuilderShouldStartFromTheListenerConfigurationWhenConnectionIsKilled to see the listener in action.

  • Refactor the code introducing ConsumerConfiguration, a helper class to hold the consumer configuration.

with the SubscriptionListener

Signed-off-by: Gabriele Santomaggio <[email protected]>
with the SubscriptionListener

Signed-off-by: Gabriele Santomaggio <[email protected]>
with the SubscriptionListener

Signed-off-by: Gabriele Santomaggio <[email protected]>
with the SubscriptionListener

Signed-off-by: Gabriele Santomaggio <[email protected]>
with the SubscriptionListener

Signed-off-by: Gabriele Santomaggio <[email protected]>
Signed-off-by: Gabriele Santomaggio <[email protected]>
@Gsantomaggio Gsantomaggio changed the title Complete the stream part Implement pre-subscription hook Oct 1, 2024
@Gsantomaggio Gsantomaggio added this to the 0.1.0-RC milestone Oct 1, 2024
@Gsantomaggio Gsantomaggio marked this pull request as ready for review October 1, 2024 14:33
Signed-off-by: Gabriele Santomaggio <[email protected]>
Signed-off-by: Gabriele Santomaggio <[email protected]>
Signed-off-by: Gabriele Santomaggio <[email protected]>
@lukebakken lukebakken self-assigned this Oct 1, 2024
Signed-off-by: Gabriele Santomaggio <[email protected]>
@Gsantomaggio Gsantomaggio merged commit 9361417 into main Oct 2, 2024
2 checks passed
@Gsantomaggio Gsantomaggio deleted the complete_streams branch October 2, 2024 10:19
@lukebakken lukebakken modified the milestones: 0.2.0-beta.0, 0.1.0 Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement pre-subscription hook

3 participants