-
Notifications
You must be signed in to change notification settings - Fork 0
feat(wip): add search and on_search channels to api
#1
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
base: main
Are you sure you want to change the base?
Conversation
|
This looks good to me; but I have few fundamental question. So, I believe the idea here is to create fundamental protocol which can be adhere by all the Now, existing data-structure is like this "context": {
"...": "..."
},
"message": {
"...": "..."
}So, instead of warping the packet with the So, if we are making the meta then doesn't it mean that we have to change the existing protocol structure of beckn? |
|
Currently, the Beckn Protocol specification is a little HTTP-oriented. Several fields, like the signature, are sent as HTTP headers according to the OpenAPI definition of the protocol. To ensure the pub sub spec also has these features, I created a little 'envelope' that has two parts - a |
|
I agree with that approach. However one query which isn't all the packet which origin from BAP or BPPs are already HTTP-oriented that mean they already have define specification such ttl & signature. So, are we again here warping those packet with new HTTP specification . I was thinking that we can leverage existing HTTP specs and just create another meta{} inside the context. |
I didn't understand what you meant to say, could you please elaborate? Edit: I think you mean that we are duplicating the fields that are already in
I think we should try to keep the Core APIs and schemas the same. Adding |
|
Basically in the HTTP implementation, the Beckn request is inside the request body, while in the Pub-Sub implementation, the Beckn request is inside the HTTP-specific things like |
|
Btw gateways don't read context. They only read headers. |
|
Hi, I have just added the minimum set of schemas to the spec for the You could view a simulation and documentation of the spec here. |
Description
This PR adds the
searchandon_searchchannels to the asynchronous API.Architecture
Here is a very basic architecture diagram for making a search request using a pub-sub architecture:
sequenceDiagram participant BA as Beckn Application participant BG as Beckn Gateway (Message Broker) participant BP as Beckn Provider BA ->> BG: BA publishes request to `search` channel BG ->> BP: BG propagates `search` request to BPs BP ->> BG: Each BP publishes its response to the `on_search` channel BG ->> BA: BG propagates `on_search` responses to the BAThis architecture assumes the following:
searchchannel while registering (Maybe registration can be done via a REST API call to the Beckn Gateway?)For a search request, here is the flow of events:
searchchannel.on_searchchannel.on_searchchannel and receives responses from each Beckn Provider asynchronously.Schemas
All messages sent in any channel will be sent in the following 'envelope':
{ "meta": { "signature": { "hash": "string", "digest": "string", "algorithm": "ed25519" } }, "data": { "context": { "...": "..." }, "message": { "...": "..." } } }The
metafield is the request metadata, equivalent to the headers of an HTTP request. Thedatafield is the Beckn request data, equivalent to the body of an HTTP request.The
signaturefield (for now) simply includes the hex-encoded hash of thedataobject as JSON with no newlines/spaces/indentation. This field should then be signed by the message publisher's private key, and the digital signature thus created can be placed in thedigestfield.The
contextfield contains information about the request/response and entity making the request/response. Themessagefield differs based on the operation being performed (search,init,confirm, etc.)@Vedsaga @venkatramanm please review and let me know what could be improved!