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

Support receiving cloud events using HTTP endpoint #889

Closed
ctron opened this issue Nov 20, 2020 · 2 comments
Closed

Support receiving cloud events using HTTP endpoint #889

ctron opened this issue Nov 20, 2020 · 2 comments
Milestone

Comments

@ctron
Copy link
Contributor

ctron commented Nov 20, 2020

I think it makes sense for Ditto to support receiving Ditto Protocol JSON messages also via Cloud Events.

While cloud events provide bindings for Kafka, MQTT, … they also have an HTTP endpoint binding, which can easily be used in the combination with Knative. So it would be possible, to easily map incoming messages from any Knative eventing source, to Ditto, acting as a Knative eventing sink.

The payload of these events would be expected to be "Ditto Protocol payload (JSON)".

I would be volunteering to work on this.

@thjaeckle
Copy link
Member

thjaeckle commented Nov 20, 2020

Cool 👍
As discussed in Gitter.IM we would appreciate such a contribution.
Implementation hints:

private Signal<?> jsonToDittoSignal(final String jsonString) {
   final JsonObject jsonObject = JsonObject.of(jsonString);
   final JsonifiableAdaptable jsonifiableAdaptable = ProtocolFactory.jsonifiableAdaptableFromJson(jsonObject);
   final DittoProtocolAdapter dittoProtocolAdapter = DittoProtocolAdapter.newInstance();
   return dittoProtocolAdapter.fromAdaptable(jsonifiableAdaptable);
}
  • The created Signal has to be passed into a handlePerRequest variant of org.eclipse.ditto.services.gateway.endpoints.routes.AbstractRoute

Regarding naming and verb of the new endpoint I would suggest:

  • using POST as verb
  • regarding the "noun" I am not yet sure ..
    • /events for example would not fit IMO as Ditto Protocol JSON messages are not always events, but also commands
    • /protocolMessages could be an option, however I would like to prevent using camel case or a dash in the endpoint
    • maybe /signals as all Ditto Protocol JSON messages represent Signals: https://www.eclipse.org/ditto/basic-signals.html

ctron added a commit to ctron/ditto that referenced this issue Nov 24, 2020
This change adds support for receiving cloud events through the HTTP
binding.

The event's payload must be in the Ditto Protocol JSON.

Signed-off-by: Jens Reimann <jreimann@redhat.com>
ctron added a commit to ctron/ditto that referenced this issue Nov 24, 2020
This change adds support for receiving cloud events through the HTTP
binding.

The event's payload must be in the Ditto Protocol JSON.

Signed-off-by: Jens Reimann <jreimann@redhat.com>
ctron added a commit to ctron/ditto that referenced this issue Nov 25, 2020
This change adds support for receiving cloud events through the HTTP
binding.

The event's payload must be in the Ditto Protocol JSON.

Signed-off-by: Jens Reimann <jreimann@redhat.com>
ctron added a commit to ctron/ditto that referenced this issue Nov 26, 2020
This change adds support for receiving cloud events through the HTTP
binding.

The event's payload must be in the Ditto Protocol JSON.

Signed-off-by: Jens Reimann <jreimann@redhat.com>
ctron added a commit to ctron/ditto that referenced this issue Nov 26, 2020
This change adds support for receiving cloud events through the HTTP
binding.

The event's payload must be in the Ditto Protocol JSON.

Signed-off-by: Jens Reimann <jreimann@redhat.com>
ctron added a commit to ctron/ditto that referenced this issue Nov 26, 2020
This change adds support for receiving cloud events through the HTTP
binding.

The event's payload must be in the Ditto Protocol JSON.

Signed-off-by: Jens Reimann <jreimann@redhat.com>

Co-authored-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
ctron added a commit to ctron/ditto that referenced this issue Nov 26, 2020
This change adds support for receiving cloud events through the HTTP
binding.

The event's payload must be in the Ditto Protocol JSON.

Co-authored-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
Signed-off-by: Jens Reimann <jreimann@redhat.com>
ctron added a commit to ctron/ditto that referenced this issue Nov 26, 2020
This change adds support for receiving cloud events through the HTTP
binding.

The event's payload must be in the Ditto Protocol JSON.

Co-authored-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
Signed-off-by: Jens Reimann <jreimann@redhat.com>
ctron added a commit to ctron/ditto that referenced this issue Nov 26, 2020
This change adds support for receiving cloud events through the HTTP
binding.

The event's payload must be in the Ditto Protocol JSON.

Co-authored-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
Signed-off-by: Jens Reimann <jreimann@redhat.com>
ctron added a commit to ctron/ditto that referenced this issue Nov 26, 2020
This change adds support for receiving cloud events through the HTTP
binding.

The event's payload must be in the Ditto Protocol JSON.

Co-authored-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
Signed-off-by: Jens Reimann <jreimann@redhat.com>
ctron added a commit to ctron/ditto that referenced this issue Nov 26, 2020
This change adds support for receiving cloud events through the HTTP
binding.

The event's payload must be in the Ditto Protocol JSON.

Co-authored-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
Signed-off-by: Jens Reimann <jreimann@redhat.com>
ctron added a commit to ctron/ditto that referenced this issue Nov 26, 2020
This change adds support for receiving cloud events through the HTTP
binding.

The event's payload must be in the Ditto Protocol JSON.

Co-authored-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
Signed-off-by: Jens Reimann <jreimann@redhat.com>
ctron added a commit to ctron/ditto that referenced this issue Nov 27, 2020
This change adds support for receiving cloud events through the HTTP
binding.

The event's payload must be in the Ditto Protocol JSON.

Co-authored-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
Signed-off-by: Jens Reimann <jreimann@redhat.com>
ctron added a commit to ctron/ditto that referenced this issue Nov 27, 2020
This change adds support for receiving cloud events through the HTTP
binding.

The event's payload must be in the Ditto Protocol JSON.

Co-authored-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
Signed-off-by: Jens Reimann <jreimann@redhat.com>
thjaeckle added a commit to ctron/ditto that referenced this issue Nov 30, 2020
* set response-required=false and requested-acks=twin-persisted via DittoHeadersBuilder (accept cloudevent requests with a 202 once persisted)
* undid initializing DittoProtocolAdapter in a special way as this is not required
* fixed that AbstractShardedPersistenceActor did not send back errors when response-required=false and requested-acks=twin-persisted was set in combination
* applied codeformatter / organized imports
* adjusted log statements to contain "CloudEvent"
* adjusted some javadocs

Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
thjaeckle added a commit to ctron/ditto that referenced this issue Nov 30, 2020
…alculated headers e.g. containing authentication information

Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
thjaeckle added a commit that referenced this issue Dec 1, 2020
[#889]: Implement cloud events HTTP endpoint
ctron added a commit to ctron/ditto that referenced this issue Dec 4, 2020
This change adds support for receiving cloud events through the HTTP
binding.

The event's payload must be in the Ditto Protocol JSON.

Co-authored-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
Signed-off-by: Jens Reimann <jreimann@redhat.com>
ctron pushed a commit to ctron/ditto that referenced this issue Dec 4, 2020
* set response-required=false and requested-acks=twin-persisted via DittoHeadersBuilder (accept cloudevent requests with a 202 once persisted)
* undid initializing DittoProtocolAdapter in a special way as this is not required
* fixed that AbstractShardedPersistenceActor did not send back errors when response-required=false and requested-acks=twin-persisted was set in combination
* applied codeformatter / organized imports
* adjusted log statements to contain "CloudEvent"
* adjusted some javadocs

Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
ctron pushed a commit to ctron/ditto that referenced this issue Dec 4, 2020
…alculated headers e.g. containing authentication information

Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
@thjaeckle thjaeckle added this to the 1.5.0 milestone Dec 9, 2020
@thjaeckle
Copy link
Member

I would close this as the basic functionality is available via #895

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

No branches or pull requests

2 participants