We still actively developing the protocol. It could change significantly
- Incoming messages: Sent from Syncmaven to enrichment or destination.
- Reply messages: Sent from destination or enrichment to Syncmaven.
RPC_URL
and RPC_SECRET
. Destinations should make a POST
request
to ${RPC_URL}/<method>
with Authorization: Bearer ${RPC_SECRET}
in the header.
Destination flow
Here is the sequence diagram detailing the message interactions within the sync process.Message References
log
reply message
Used for
destination
and enrichment
halt
reply message
Used for
destination
and enrichment
describe
Incoming Message
Used for
destination
and enrichment
spec
is for an enrichment or destination, with only one parameter - {"type": "describe"}
.
Upon request, the destination or enrichment responds with a spec
message.
spec
reply message
Used for
destination
and enrichment
credentialsSchema
maybe a Zod-schema or JSON-schema.
describe-streams
incoming message
Used for
destination
start-stream
incoming message
Used for
destination
start-enrichment
incoming message
Used for
enrichment
enrichment-request
incoming message
Used for
enrichment
enrichment-reply
reply message
Used for
enrichment
row
incoming message
Used for
destination
end-stream
incoming message
Used for
destination
State management
State is used by destination to cache the artifacts of the previous run to remember what was synced to optimize subsequent runs. It could also be used by enrichment to cache the calls to remote APIs.State should be treated as optimization cache. Sync shouldn’t rely on it’s presence. If state is empty, a full sync should be run.
RPC_URL
and RPC_SECRET
.
Destinations should make a POST
request to ${RPC_URL}/<method>
with Authorization: Bearer ${RPC_SECRET}
in the header. Each call must an JSON body, reply is also a JSON object.
Keys and values
State is a key-value store. Keys are tuples of segments which are strings. If key contains one segment, it can be represented as a string instead of an array size of 1. Values are arbitrary JSON objects. Example of the key:["syncId=123", "type=cursor"]
You should always include a
syncId
in the key to avoid conflicts between different syncs. syncId
is a unique identifier of the sync configuration
and is passed along with start-stream
or start-enrichment
messages.state.get
Get a value by key.
state.set
Sets a value for a key.
state.delete
Deletes a value by key.
state.deleteAll
Deletes all values with keys starting with the given prefix. Include both ["segment1", "segment2"]
and ["segment1", "segment2", "segment3"]
state.list
List all key-value pairs with keys starting with the given prefix (e.g. ["segment1", "segment2"]
or
["segment1", "segment2", "segment3"]
). The response is streamed since the response can be large. It’s advised to use a streaming JSON parser to process the response.