Skip to content

Instantly share code, notes, and snippets.

@ilgooz
Last active July 22, 2018 15:36
Show Gist options
  • Save ilgooz/17ca05ab45a398c7bc4f52e5616e021e to your computer and use it in GitHub Desktop.
Save ilgooz/17ca05ab45a398c7bc4f52e5616e021e to your computer and use it in GitHub Desktop.
execution := application.NewExecution("v1_yyy", "send") // has Name, Info, Data inputs
mapper := application.NewMapper(func(req *application.Request) interface {} {
var data eventOutput
req.Get(&data)
data.Info = "info"
return data
})
// Wait for request event from v1_xxx service but filter with name=x.
// Execute send from v1_yyy with data by mapper.
app.WhenEvent("v1_xxx").Event("request").Filter("name", "x").Map(mapper).Execute(execution)
type eventOutput struct {
Name string
Info string
Data interface{}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment