Runner: reads each module's events on its own durable <node>_<module>_tools, beside the program's (A-397)
This commit is contained in:
@@ -1075,6 +1075,13 @@ func ConsumerOf(node, module string) string {
|
||||
return node + "_" + module
|
||||
}
|
||||
|
||||
// ToolsSuffix ends the name of the tool runner's own durable consumer of a module: the runner and the module's program each
|
||||
// need every event, so each reads under a name of its own (lead answer A-397); only a work queue shares one name.
|
||||
const ToolsSuffix = "_tools"
|
||||
|
||||
// ToolsConsumerOf is the tool runner's durable consumer of a module on a machine: `<node>_<module>_tools`.
|
||||
func ToolsConsumerOf(node, module string) string { return ConsumerOf(node, module) + ToolsSuffix }
|
||||
|
||||
// NakDelay is how long an event a handler failed waits before it is offered again: a transient cause
|
||||
// gets another attempt, a permanent one exhausts the consumer's max-deliver rather than spinning. The
|
||||
// consumer then gives the event up, and the mesh keeps it in DEAD_LETTERS until a person delivers
|
||||
@@ -1125,7 +1132,7 @@ var tickHook func()
|
||||
// answers true (nil is always): a module whose children asked for no heartbeat costs the bus no consumer-info request.
|
||||
func (c *Conn) ConsumeAsBeatingWhen(module string, deliver func(Envelope) error, beat func(Beat), wanted func() bool) (func(), error) {
|
||||
asked := func() bool { return beat != nil && (wanted == nil || wanted()) }
|
||||
durable := ConsumerOf(c.node, module)
|
||||
durable := ToolsConsumerOf(c.node, module)
|
||||
js, err := jetstream.New(c.nc)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -269,6 +269,8 @@ func (h *hearing) reconcile() {
|
||||
if m := h.c.Membership(h.module); m != nil {
|
||||
for _, heard := range m.Hears {
|
||||
if heard.Stream != "" && heard.Consumer != "" {
|
||||
// The runner's own durable beside the program's (A-397).
|
||||
heard.Consumer += ToolsSuffix
|
||||
want[heard] = true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user