Skip to content

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

Merged
maxekman merged 1 commit into
looplab:mainfrom
klowdo:main
May 7, 2022
Merged

maxekman merged 1 commit into
looplab:mainfrom
klowdo:main

Conversation

@klowdo

@klowdo klowdo commented Mar 11, 2022

Copy link
Copy Markdown
Collaborator

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
Copy Markdown

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