seneca-mesh icon indicating copy to clipboard operation
seneca-mesh copied to clipboard

Default broadcast handler

Open zhaoyao91 opened this issue 8 years ago • 1 comments

Say, I have 3 services running in 3 processes. One is to handle a message and send a broadcast, the other two will receive the broadcast and do some related works. The problem is, if I act on service 1 while the broadcast receiver services are not available, it will complain that cannot find service to handle such a message. But if I define a handler for this broadcast on service 1, the other two services will never receiver this broadcast. So how can I define a default broadcast receiver on service 1? Or how should service 1 fire the message and forget it no matter if there is any other receiver?

zhaoyao91 avatar Feb 23 '17 18:02 zhaoyao91

This is a valid use case and needs to be handled more cleanly.

In one sense, the errors in the sender are valid, but in another, they are just noise in your logs.

At the moment, the best solution is to use the Seneca default$ directive in your message:

seneca.act('foo:bar, default$:{}')

This will "ignore" messages that have no route.

rjrodger avatar Mar 06 '17 12:03 rjrodger