-
Notifications
You must be signed in to change notification settings - Fork 304
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
Update Subscribe and Managed Subscribe examples #60
Conversation
java/README.md
Outdated
@@ -47,6 +47,7 @@ In the `src/main` directory of the project, you will find several sub-directorie | |||
* `NUMBER_OF_EVENTS_TO_PUBLISH`: Specify the number of events to publish while using the PublishStream RPC. | |||
* `SINGLE_PUBLISH_REQUEST`: Specify if you want to publish the events in a single or multiple PublishRequests. | |||
* `NUMBER_OF_EVENTS_IN_FETCHREQUEST`: Specify the number of events that the Subscribe RPC requests from the server in each FetchRequest. The example fetches at most 5 events in each Subscribe request. If you pass in more than 5, it sends multiple Subscribe requests with at most 5 events requested in FetchRequest each. For more information about requesting events, see [Pull Subscription and Flow Control](https://developer.salesforce.com/docs/platform/pub-sub-api/guide/flow-control.html) in the Pub/Sub API documentation. | |||
* `PROCESS_CHANGED_FIELDS`: Specify whether the Subscribe or ManagedSubscribe client should process the [ChangedFields](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_eventbus_ChangeEventHeader.htm#apex_eventbus_ChangeEventHeader_changedfields) header in ChangeDataCapture (CDC) events. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ChangeDataCapture -> Change Data Capture
@knhage thoughts about the wording here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sidd0610 This should be for all the bitmap fields in ChangeEventHeader:
changedFields, diffFields, and nulledFields
This is doc'd in Event Deserialization Considerations.
So I suggest rewording to:
PROCESS_CHANGE_EVENT_HEADER_FIELDS
: Specify whether the Subscribe or ManagedSubscribe client process the change data capture event bitmap fields in ChangeEventHeader. See Event Deserialization Considerations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sidd0610 I just realized that the client expands only the changedFields bitmap field. Maybe we can change the text to the following:
PROCESS_CHANGE_EVENT_HEADER_FIELDS
: Specify whether the Subscribe or ManagedSubscribe client process the change data capture event bitmap fields in ChangeEventHeader. In this sample, only thechangedFields
field is expanded. To expand thediffFields
andnulledFields
header fields, modify the sample code. See Event Deserialization Considerations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added comments.
@@ -265,6 +267,26 @@ public static GenericRecord deserialize(Schema schema, ByteString payload) throw | |||
return reader.read(null, decoder); | |||
} | |||
|
|||
public static void processAndPrintChangedFields(Schema writerSchema, GenericRecord record) throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that we print only the changed fields. Is it possible to add a comment similar to:
// This method expands the changedFields bitmap field in ChangeEventHeader. To expand the other bitmap fields, diffFields and nulledFields, modify this code.
@@ -43,6 +43,8 @@ NUMBER_OF_EVENTS_IN_FETCHREQUEST: null | |||
REPLAY_PRESET: null | |||
# Replay ID in ByteString | |||
REPLAY_ID: null | |||
# Flag to enable/disable ChangedFields processing in Subscribe and ManagedSubscribe examples for CDC events (default: false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a comment on another thread about this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added an edit in arguments.yaml
@@ -43,6 +43,8 @@ NUMBER_OF_EVENTS_IN_FETCHREQUEST: null | |||
REPLAY_PRESET: null | |||
# Replay ID in ByteString | |||
REPLAY_ID: null | |||
# Flag to enable/disable bitmap field processing in Subscribe and ManagedSubscribe examples for CDC events (default: false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edit:
# Flag to enable/disable bitmap ChangeEventHeader field processing in Subscribe and ManagedSubscribe examples for change data capture events (default: false)
This PR aims to remove the
ProcessChangeEventHeader
as a separate example and make the processing ofChangedFields
flow a part of theSubscribe
andManagedSubscribe
examples. It also introduces a new Optional Configuration calledPROCESS_CHANGED_FIELDS
which lets a customer enable/disable the flow.