Repository navigation
Conversation
A workflow listener is an internal callback whose data names the run, so the table has one record shape and the delivery dispatches on the variant. Describe and the metrics derive the kind from it.
The channel kept one post in flight per callback listener and folded what arrived meanwhile, and a channel deleted by the idle task started fresh on the next notify. Neither had a test.
…istener-callbacks
…istener-callbacks
Owner
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR holds a channel's workflow and callback listeners in one table of callbacks.
What changed?
chasm/lib/channelare oneListenersmap keyed by listener id, of one recordListenerthat holds atemporal.api.common.v1.Callback. A URL callback is theNexusvariant with its URL and headers. A workflow listener is theInternalvariant, whosedatais a marshalledWorkflowTargetwith the namespace id, workflow id, run id and first execution run id. Delivery dispatches on the variant:Nexusthrough the outbound callback task,Internalthrough the routedDeliverChannelNotificationon the run's shard.RegisterWorkflowListenerstays the internal entry point and writes anInternalentry under the workflow id, so a later run of the same workflow still takes the entry of the run before it. Re-key and forget decode the target, check the run and write it back.DescribeChannelkeeps its wire shape. The listener kind, workflow id and run id are derived from the variant, workflow listeners first, each kind in id order. Thelistener_kindmetrics tag is derived from the variant too.InvalidArgument, and so is a workflow registering under a callback's id.TestNotificationChannelCallbackDeliveriesInOrdersends a burst of rising counters to a slow endpoint and checks that the counters it saw only rise and end on the last one.TestNotificationChannelRecreatedAfterRetentioncovers it with a one-second retention. A poller holding a counter from the old channel sees only the new notification.tests/notification_channel_test.goreads theListeners#<id>node, and the unit tests read the one map.TestWorkflowListenerIsAnInternalCallbackpins the record shape.Part of AI-198 (epic AI-37).
Why?
The next layer addresses a channel's owner by
Execution, a workflow or a standalone activity, and a listener table with one map per kind would grow a third map for it. One record that says where a notification goes, in the shape the server already uses for completion callbacks, lets a new kind of listener be a new target inside theInternaldata rather than a new table. The two checks are here because folding the table is only safe once the behaviour it had, in-order posts and the retention cycle, is pinned by tests.How did you test it?
go build ./..., golangci-lint and theerrortypevet are clean onchasm/lib/channelandtests. The channel unit tests ran, with the new record-shape case. The functional tests ran with-tags disable_grpc_modules,test_dep: the notification channel suite including the two new cases, and the linked channel, inline handoff, stream channel, describe channels and unsubscribe suites, all unchanged apart from the renamed node in the callback-pending helper.