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

fix(eventstore/mongodb): pass context with transaction to inTx handler #386

Merged
merged 1 commit into from
May 7, 2022

Conversation

klowdo
Copy link
Collaborator

@klowdo klowdo commented Mar 11, 2022

Description

pass context with transaction to eventHandlerInTX

Affected Components

  • Event Store, outbox

Related Issues

Solution and Design

passes the txCtx with transaction to handler instead of empty context

Steps to test and verify

In handler that is assigned WithEventHandlerInTX write this below and you should get no session without this fix

func (c *myHandler)  HandleEvent(ctx context.Context, e eh.Event) error{
  session := mongodb.SessionFromContext(ctx)
  if session  == nil {
    fmt.Println("no session")
  } else {
     fmt.Printf("session: %v", session.ID())
  }
}

@coveralls
Copy link

Coverage Status

Coverage increased (+0.07%) to 68.813% when pulling 441b029 on klowdo:main into d9133a0 on looplab:main.

@maxekman maxekman merged commit 9da9436 into looplab:main May 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants