-
Notifications
You must be signed in to change notification settings - Fork 50
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
flux-event: support raw payloads, pub --loopback, and man page #1488
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1488 +/- ##
==========================================
- Coverage 78.72% 78.71% -0.01%
==========================================
Files 164 164
Lines 30429 30475 +46
==========================================
+ Hits 23955 23989 +34
- Misses 6474 6486 +12
|
Ok, #1486 is merged. Once this one is rebased I'll merge it. |
In the pub subcommand: - tidy up parsing of topic, payload - skip redundant JSON parse check (flux_event_encode does it) - drop json-c dependency
Add pub --raw option, which causes payload argument, if any, to be interpreted as raw data not JSON.
In the sub subcommand: - structure event_sub_register() like event_pub_register() - don't reuse 'n' variable - simplify subscribe/unsubscribe logic - eliminate unnecessary 'raw' variable
Problem: "flux event sub --raw" produces the same result as "FLUX_HANDLE_TRACE=1 flux event sub", and is confusing given the addition of the "flux event pub --raw" option. Drop the sub --raw option.
It's a bit cleaner to use a reactor callback to process events in "flux event sub" subcommand. Drop comment about cleaning up on SIGINT, as unsubscribing is more of a formality anyway. It is handled automatically on disconnect from the broker.
If pub --loopback is specified, subscribe to the published event, publish it, and wait for it to be received before exiting.
Add some coverage for event encode/decode by publishing events with payloads that are empty, JSON, and raw, in --loopback mode.
33b27ae
to
02a679a
Compare
Coverage is low but I think we should still merge this. |
I don't mind working on that a bit if you want to merge the other one first. |
I leave it up to you 😀 |
I'd say merge this one as is and I'll see if I can address the coverage in the final event PR that I haven't posted yet. |
Got it! |
This was peeled off of pr #1486 and is based on top of it (will rebase once that gets merged).
This enhances the
flux-event
command. In addition to general cleanup, it adds support for events with raw (non-JSON) payloads, and aflux event pub --loopback
option that waits for published events to be received before exiting. It also adds a manual page for the command and a couple of tests.