Skip to content

[Scheduler] add schedule name to ScheduledStamp #49864

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

kbond
Copy link
Member

@kbond kbond commented Mar 29, 2023

Q A
Branch? 6.3
Bug fix? no
New feature? yes
Deprecations? no
Tickets n/a
License MIT
Doc PR todo

As discussed in #49838, it would be nice to have the schedule name available on the stamp.

) {
}

public function get(): iterable
{
foreach ($this->messageGenerator->getMessages() as $message) {
yield Envelope::wrap($message, [new ScheduledStamp()]);
yield Envelope::wrap($message, [new ScheduledStamp($this->name)]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but that doesn't work: the name is something that belongs to a schedule, not to the transport. The generated messages can come from many schedules.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each schedule has its own transport though.

fabpot added a commit that referenced this pull request Apr 24, 2023
…ing context (tucksaun)

This PR was merged into the 6.3 branch.

Discussion
----------

[Scheduler] Make `MessageGenerator` yield some scheduling context

| Q             | A
| ------------- | ---
| Branch?       | 6.3
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #50085, "replaces" #50096?, could help with #49864
| License       | MIT
| Doc PR        | no doc yet for Scheduler

This PR introduces a new `MessageContext` that `MessageGenerator` should use as key when yielding messages to provide more context about the scheduled message.
The consumer of the scheduled messages can decide to use it or not.
The PR also adds the wiring to add this context to the `ScheduledStamp` when using Scheduler within Messenger.
This allows to add more context but without introducing a hard dependency on Messenger.

/cc `@kbond`

Note: this PR is not adding the scheduler name (cf #49864) because I don't know exactly where to wire it yet but I don't see anything preventing it to be added to the context once we know where it should belong.

Commits
-------

3664d08 [Scheduler] Allow MessageGenerator to provide a MessageContext
@kbond
Copy link
Member Author

kbond commented Apr 25, 2023

Closing in favour of #50155.

@kbond kbond closed this Apr 25, 2023
@kbond kbond deleted the scheduler-name branch April 25, 2023 22:43
fabpot added a commit that referenced this pull request Apr 26, 2023
This PR was merged into the 6.3 branch.

Discussion
----------

[Scheduler] add schedule name to `MessageContext`

| Q             | A
| ------------- | ---
| Branch?       | 6.3
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | n/a
| License       | MIT
| Doc PR        | n/a

Alternative to #49864.

Commits
-------

dc0f0e2 [Scheduler] add schedule name to `MessageContext`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants