Skip to content
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

feat: added "responseTo" field in worker emitted events #141

Merged
merged 1 commit into from
Sep 18, 2023

Conversation

DuckBoss
Copy link
Contributor

@DuckBoss DuckBoss commented Jul 18, 2023

Currently uses cherry-picked commits from dependent PR: #140 which needs to be removed when the dependent PR gets approved and merged.

@DuckBoss DuckBoss force-pushed the jajerome/reponse-to-in-events branch from 61fc821 to 37cc3c2 Compare July 19, 2023 20:41
@DuckBoss DuckBoss force-pushed the jajerome/reponse-to-in-events branch 2 times, most recently from 7c8c84c to 93be077 Compare August 11, 2023 17:59
@DuckBoss DuckBoss marked this pull request as ready for review August 14, 2023 20:16
Copy link
Collaborator

@subpop subpop left a comment

Choose a reason for hiding this comment

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

This should be able to be streamlined if in #140, we replace message string with data map[string]string everywhere, even in the WorkerEvent struct.

@@ -62,6 +63,7 @@
<arg type="s" name="worker" />
<arg type="u" name="name" />
<arg type="s" name="message_id" />
<arg type="s" name="response_to" />
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can avoid breaking this API by putting the response_to field below message.

@DuckBoss DuckBoss force-pushed the jajerome/reponse-to-in-events branch 4 times, most recently from fe7dc7e to 8f56c5d Compare August 29, 2023 20:41
@DuckBoss DuckBoss changed the title [WIP] feat: added "responseTo" field in worker emitted events feat: added "responseTo" field in worker emitted events Aug 29, 2023
@DuckBoss DuckBoss force-pushed the jajerome/reponse-to-in-events branch 5 times, most recently from fa45061 to d3ac092 Compare September 6, 2023 16:40
@DuckBoss DuckBoss requested a review from subpop September 6, 2023 16:58
@DuckBoss DuckBoss force-pushed the jajerome/reponse-to-in-events branch from d3ac092 to 8bb097c Compare September 15, 2023 14:09
if err := w.EmitEvent(
ipc.WorkerEventNameWorking,
rcvId,
echoId,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is interesting. Prior to this change, each event emitted by the worker
would have the message ID of the received message in the first field, resulting
in output that looks like:

2023/09/15 12:52:45 echo: 53a8d7d5-e5cb-495c-9d18-2e055d566638: BEGIN: {}
2023/09/15 12:52:45 echo: 53a8d7d5-e5cb-495c-9d18-2e055d566638: WORKING: {"message":"echoing [104 101 108 108 111]"}
2023/09/15 12:52:45 echo: 53a8d7d5-e5cb-495c-9d18-2e055d566638: END: {}

Now however, the BEGIN and END events have the originating message ID first:

2023/09/15 12:52:45 echo: 53a8d7d5-e5cb-495c-9d18-2e055d566638: BEGIN: : {}
2023/09/15 12:52:45 echo: 80a83707-f982-4e82-82e5-90f06198f70e: WORKING: 53a8d7d5-e5cb-495c-9d18-2e055d566638: {"message":"echoing [104 101 108 108 111]"}
2023/09/15 12:52:45 echo: 53a8d7d5-e5cb-495c-9d18-2e055d566638: END: : {}

The two events handled by the worker package don't have any awareness to the
"response_to" field, so they don't print anything for that value. The WORKING
event is emitted by the echo worker, and it has created a new UUID for a
response message and puts that into the value of WORKING.

Overall, I don't think this is a significant flaw in this PR. But the way its
handled in this echo worker feels conflicted. I think it should continue to emit
the WORKING event, using the message ID of the received message as the first
field to the EmitEvent function. The "responseTo" function parameter has not
changed its meaning; it is still the value of the "response_to" field in the
received message.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the feedback!
I've reverted the commit that made this change so now it should continue to emit the message ID of the received message in the EmitEvent function for the WORKING event.

@DuckBoss DuckBoss force-pushed the jajerome/reponse-to-in-events branch from 8bb097c to cb0e2b5 Compare September 15, 2023 18:25
@DuckBoss DuckBoss requested a review from subpop September 15, 2023 18:38
Copy link
Collaborator

@subpop subpop left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@subpop subpop left a comment

Choose a reason for hiding this comment

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

LGTM

@subpop subpop merged commit f787dd0 into RedHatInsights:main Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants