-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
421 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,161 @@ | ||
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT | ||
|
||
= Websocket Source | ||
|
||
*Provided by: "Apache Software Foundation"* | ||
|
||
*Support Level for this Kamelet is: "Preview"* | ||
|
||
Websocket endpoints for communicating with clients | ||
|
||
== Configuration Options | ||
|
||
The following table summarizes the configuration options available for the `websocket-source` Kamelet: | ||
[width="100%",cols="2,^2,3,^2,^2,^3",options="header"] | ||
|=== | ||
| Property| Name| Description| Type| Default| Example | ||
| *resourceUri {empty}* *| Resource Uri| Name of the websocket channel to use.| string| | | ||
| allowedOrigins| Allowed Origins| The CORS allowed origins. Use to allow all.| string| `""`| | ||
| bridgeErrorHandler| Bridge Rrror Handler| Allows for bridging the consumer to the Camel routing Error Handler| bool| `false`| | ||
| bufferSize| Buffer Size| Set the buffer size of the websocketServlet| integer| `8192`| | ||
| crossOriginFilterOn| Cross Origin Filter| Whether to enable CORS.| bool| `false`| | ||
| enableJmx| Filter Path| Enable JMX support.| bool| `false`| | ||
| filterPath| Filter Path| Context path for filtering CORS.| string| `""`| | ||
| lazyStartProducer| Lazy Start Producer| Whether the producer should be started lazy (on the first message).| bool| `false`| | ||
| maxBinaryMessageSize| Max Binary Message Size| Can be used to set the size in bytes that the websocket created by the websocketServlet may be accept before closing. (Default is -1 - or unlimited).| integer| `-1`| | ||
| maxIdleTime| Max Idle Time| SetSet the time in ms that the websocket created by the websocketServlet may be idle before closing.| integer| `300000`| | ||
| sendTimeout| Send Timeout| Timeout in millis when sending to a websocket channel. The default timeout is 30000 (30 seconds).| integer| `30000`| | ||
| sessionSupport| Session Support| Whether to enable session support which enables HttpSession for each http request.| bool| `false`| | ||
| subprotocol| Subprotocol| Comma-separated list of subprotocols that are supported by the application.| string| `"any"`| | ||
| websocketHost| Host| The hostname| string| `"0.0.0.0"`| | ||
| websocketPort| Port| The port number| integer| `9292`| | ||
|=== | ||
|
||
NOTE: Fields marked with an asterisk ({empty}*) are mandatory. | ||
|
||
|
||
== Dependencies | ||
|
||
At runtime, the `websocket-source` Kamelet relies upon the presence of the following dependencies: | ||
|
||
- camel:kamelet | ||
- camel:core | ||
- camel:websocket | ||
|
||
== Usage | ||
|
||
This section describes how you can use the `websocket-source`. | ||
|
||
=== Knative Source | ||
|
||
You can use the `websocket-source` Kamelet as a Knative source by binding it to a Knative object. | ||
|
||
.websocket-source-binding.yaml | ||
[source,yaml] | ||
---- | ||
apiVersion: camel.apache.org/v1alpha1 | ||
kind: KameletBinding | ||
metadata: | ||
name: websocket-source-binding | ||
spec: | ||
source: | ||
ref: | ||
kind: Kamelet | ||
apiVersion: camel.apache.org/v1alpha1 | ||
name: websocket-source | ||
properties: | ||
resourceUri: "The Resource Uri" | ||
sink: | ||
ref: | ||
kind: Channel | ||
apiVersion: messaging.knative.dev/v1 | ||
name: mychannel | ||
---- | ||
|
||
==== *Prerequisite* | ||
|
||
You have xref:{camel-k-version}@camel-k::installation/installation.adoc[Camel K installed] on the cluster. | ||
|
||
==== *Procedure for using the cluster CLI* | ||
|
||
. Save the `websocket-source-binding.yaml` file to your local drive, and then edit it as needed for your configuration. | ||
|
||
. Run the source by using the following command: | ||
+ | ||
[source,shell] | ||
---- | ||
kubectl apply -f websocket-source-binding.yaml | ||
---- | ||
|
||
==== *Procedure for using the Kamel CLI* | ||
|
||
Configure and run the source by using the following command: | ||
|
||
[source,shell] | ||
---- | ||
kamel bind websocket-source -p "source.resourceUri=The Resource Uri" channel:mychannel | ||
---- | ||
|
||
This command creates the KameletBinding in the current namespace on the cluster. | ||
|
||
=== Kafka Source | ||
|
||
You can use the `websocket-source` Kamelet as a Kafka source by binding it to a Kafka topic. | ||
|
||
.websocket-source-binding.yaml | ||
[source,yaml] | ||
---- | ||
apiVersion: camel.apache.org/v1alpha1 | ||
kind: KameletBinding | ||
metadata: | ||
name: websocket-source-binding | ||
spec: | ||
source: | ||
ref: | ||
kind: Kamelet | ||
apiVersion: camel.apache.org/v1alpha1 | ||
name: websocket-source | ||
properties: | ||
resourceUri: "The Resource Uri" | ||
sink: | ||
ref: | ||
kind: KafkaTopic | ||
apiVersion: kafka.strimzi.io/v1beta1 | ||
name: my-topic | ||
---- | ||
|
||
==== *Prerequisites* | ||
|
||
* You've installed https://strimzi.io/[Strimzi]. | ||
* You've created a topic named `my-topic` in the current namespace. | ||
* You have xref:{camel-k-version}@camel-k::installation/installation.adoc[Camel K installed] on the cluster. | ||
|
||
==== *Procedure for using the cluster CLI* | ||
|
||
. Save the `websocket-source-binding.yaml` file to your local drive, and then edit it as needed for your configuration. | ||
|
||
. Run the source by using the following command: | ||
+ | ||
[source,shell] | ||
---- | ||
kubectl apply -f websocket-source-binding.yaml | ||
---- | ||
|
||
==== *Procedure for using the Kamel CLI* | ||
|
||
Configure and run the source by using the following command: | ||
|
||
[source,shell] | ||
---- | ||
kamel bind websocket-source -p "source.resourceUri=The Resource Uri" kafka.strimzi.io/v1beta1:KafkaTopic:my-topic | ||
---- | ||
|
||
This command creates the KameletBinding in the current namespace on the cluster. | ||
|
||
== Kamelet source file | ||
|
||
https://github.com/apache/camel-kamelets/blob/main/kamelets/websocket-source.kamelet.yaml | ||
|
||
// THIS FILE IS AUTOMATICALLY GENERATED: DO NOT EDIT |
Large diffs are not rendered by default.
Oops, something went wrong.
116 changes: 116 additions & 0 deletions
116
library/camel-kamelets/src/main/resources/kamelets/websocket-source.kamelet.yaml
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
apiVersion: camel.apache.org/v1alpha1 | ||
kind: KameletBinding | ||
metadata: | ||
name: websocket-source-binding | ||
spec: | ||
source: | ||
ref: | ||
kind: Kamelet | ||
apiVersion: camel.apache.org/v1alpha1 | ||
name: websocket-source | ||
properties: | ||
resourceUri: "The Resource Uri" | ||
sink: | ||
ref: | ||
kind: KafkaTopic | ||
apiVersion: kafka.strimzi.io/v1beta1 | ||
name: my-topic | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
- route: | ||
from: | ||
uri: "kamelet:websocket-source" | ||
parameters: | ||
resourceUri: "The Resource Uri" | ||
steps: | ||
- to: | ||
uri: "log:info" | ||
|