---
apiVersion: v1
kind: List
items:
- apiVersion: v1
kind: ConfigMap
metadata:
labels:
funktion.fabric8.io/kind: Connector
provider: fabric8
project: connector-atmosphere-websocket
version: 1.1.27
group: io.fabric8.funktion.connector
name: atmosphere-websocket
data:
deployment.yml: |
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
funktion.fabric8.io/kind: Subscription
connector: atmosphere-websocket
spec:
replicas: 1
template:
metadata:
labels:
funktion.fabric8.io/kind: Subscription
connector: atmosphere-websocket
spec:
containers:
- image: fabric8/connector-atmosphere-websocket:1.1.27
name: connector
schema.yml: |
---
component:
kind: component
scheme: atmosphere-websocket
extendsScheme: servlet
syntax: atmosphere-websocket:servicePath
title: Atmosphere Websocket
description: To exchange data with external Websocket clients using Atmosphere.
label: websocket
deprecated: false
async: false
javaType: org.apache.camel.component.atmosphere.websocket.WebsocketComponent
groupId: org.apache.camel
artifactId: camel-atmosphere-websocket
version: 2.18.1
componentProperties:
servletName:
kind: property
type: string
javaType: java.lang.String
deprecated: false
secret: false
description: Default name of servlet to use. The default name is CamelServlet.
httpRegistry:
kind: property
type: object
javaType: org.apache.camel.component.servlet.HttpRegistry
deprecated: false
secret: false
description: To use a custom org.apache.camel.component.servlet.HttpRegistry.
attachmentMultipartBinding:
kind: property
type: boolean
javaType: boolean
deprecated: false
secret: false
description: Whether to automatic bind multipart/form-data as attachments on the Camel Exchange. This is turn off by default as this may require servlet specific configuration to enable this when using Servlet's.
httpBinding:
kind: property
type: object
javaType: org.apache.camel.http.common.HttpBinding
deprecated: false
secret: false
description: To use a custom HttpBinding to control the mapping between Camel message and HttpClient.
httpConfiguration:
kind: property
type: object
javaType: org.apache.camel.http.common.HttpConfiguration
deprecated: false
secret: false
description: To use the shared HttpConfiguration as base configuration.
allowJavaSerializedObject:
kind: property
type: boolean
javaType: boolean
deprecated: false
secret: false
description: Whether to allow java serialization when a request uses context-type=application/x-java-serialized-object This is by default turned off. If you enable this then be aware that Java will deserialize the incoming data from the request to Java and that can be a potential security risk.
headerFilterStrategy:
kind: property
type: object
javaType: org.apache.camel.spi.HeaderFilterStrategy
deprecated: false
secret: false
description: To use a custom HeaderFilterStrategy to filter header to and from Camel message.
properties:
servicePath:
kind: path
group: common
required: true
type: string
javaType: java.lang.String
deprecated: false
secret: false
description: Name of websocket endpoint
chunked:
kind: parameter
group: common
type: boolean
javaType: boolean
deprecated: false
secret: false
defaultValue: true
description: If this option is false the Servlet will disable the HTTP streaming and set the content-length header on the response
disableStreamCache:
kind: parameter
group: common
label: common
type: boolean
javaType: boolean
deprecated: false
secret: false
defaultValue: false
description: Determines whether or not the raw input stream from Servlet is cached or not (Camel will read the stream into a in memory/overflow to file Stream caching) cache. By default Camel will cache the Servlet input stream to support reading it multiple times to ensure it Camel can retrieve all data from the stream. However you can set this option to true when you for example need to access the raw stream such as streaming it directly to a file or other persistent store. DefaultHttpBinding will copy the request input stream into a stream cache and put it into message body if this option is false to support reading the stream multiple times. If you use Servlet to bridge/proxy an endpoint then consider enabling this option to improve performance in case you do not need to read the message payload multiple times. The http/http4 producer will by default cache the response body stream. If setting this option to true then the producers will not cache the response body stream but use the response stream as-is as the message body.
headerFilterStrategy:
kind: parameter
group: common
type: object
javaType: org.apache.camel.spi.HeaderFilterStrategy
deprecated: false
secret: false
description: To use a custom HeaderFilterStrategy to filter header to and from Camel message.
httpBinding:
kind: parameter
group: common
type: object
javaType: org.apache.camel.http.common.HttpBinding
deprecated: false
secret: false
description: To use a custom HttpBinding to control the mapping between Camel message and HttpClient.
sendToAll:
kind: parameter
group: common
type: boolean
javaType: boolean
deprecated: false
secret: false
defaultValue: false
description: Whether to send to all (broadcast) or send to a single receiver.
transferException:
kind: parameter
group: common
type: boolean
javaType: boolean
deprecated: false
secret: false
defaultValue: false
description: If enabled and an Exchange failed processing on the consumer side and if the caused Exception was send back serialized in the response as a application/x-java-serialized-object content type. On the producer side the exception will be deserialized and thrown as is instead of the HttpOperationFailedException. The caused exception is required to be serialized. This is by default turned off. If you enable this then be aware that Java will deserialize the incoming data from the request to Java and that can be a potential security risk.
useStreaming:
kind: parameter
group: common
type: boolean
javaType: boolean
deprecated: false
secret: false
defaultValue: false
description: To enable streaming to send data as multiple text fragments.
async:
kind: parameter
group: consumer
label: consumer
type: boolean
javaType: boolean
deprecated: false
secret: false
defaultValue: false
description: Configure the consumer to work in async mode
bridgeErrorHandler:
kind: parameter
group: consumer
label: consumer
type: boolean
javaType: boolean
optionalPrefix: consumer.
deprecated: false
secret: false
defaultValue: false
description: Allows for bridging the consumer to the Camel routing Error Handler which mean any exceptions occurred while the consumer is trying to pickup incoming messages or the likes will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions that will be logged at WARN/ERROR level and ignored.
eagerCheckContentAvailable:
kind: parameter
group: consumer
label: consumer
type: boolean
javaType: boolean
deprecated: false
secret: false
defaultValue: false
description: Whether to eager check whether the HTTP requests has content if the content-length header is 0 or not present. This can be turned on in case HTTP clients do not send streamed data.
httpMethodRestrict:
kind: parameter
group: consumer
label: consumer
type: string
javaType: java.lang.String
deprecated: false
secret: false
description: Used to only allow consuming if the HttpMethod matches such as GET/POST/PUT etc. Multiple methods can be specified separated by comma.
matchOnUriPrefix:
kind: parameter
group: consumer
label: consumer
type: boolean
javaType: boolean
deprecated: false
secret: false
defaultValue: false
description: Whether or not the consumer should try to find a target consumer by matching the URI prefix if no exact match is found.
optionsEnabled:
kind: parameter
group: consumer
label: consumer
type: boolean
javaType: boolean
deprecated: false
secret: false
defaultValue: false
description: Specifies whether to enable HTTP OPTIONS for this Servlet consumer. By default OPTIONS is turned off.
responseBufferSize:
kind: parameter
group: consumer
label: consumer
type: integer
javaType: java.lang.Integer
deprecated: false
secret: false
description: To use a custom buffer size on the javax.servlet.ServletResponse.
servletName:
kind: parameter
group: consumer
label: consumer
type: string
javaType: java.lang.String
deprecated: false
secret: false
defaultValue: CamelServlet
description: Name of the servlet to use
traceEnabled:
kind: parameter
group: consumer
label: consumer
type: boolean
javaType: boolean
deprecated: false
secret: false
defaultValue: false
description: Specifies whether to enable HTTP TRACE for this Servlet consumer. By default TRACE is turned off.
attachmentMultipartBinding:
kind: parameter
group: consumer (advanced)
label: consumer,advanced
type: boolean
javaType: boolean
deprecated: false
secret: false
defaultValue: false
description: Whether to automatic bind multipart/form-data as attachments on the Camel Exchange. This is turn off by default as this may require servlet specific configuration to enable this when using Servlet's.
exceptionHandler:
kind: parameter
group: consumer (advanced)
label: consumer,advanced
type: object
javaType: org.apache.camel.spi.ExceptionHandler
optionalPrefix: consumer.
deprecated: false
secret: false
description: To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions that will be logged at WARN/ERROR level and ignored.
exchangePattern:
kind: parameter
group: consumer (advanced)
label: consumer,advanced
type: string
javaType: org.apache.camel.ExchangePattern
enum:
- InOnly
- RobustInOnly
- InOut
- InOptionalOut
- OutOnly
- RobustOutOnly
- OutIn
- OutOptionalIn
deprecated: false
secret: false
description: Sets the exchange pattern when the consumer creates an exchange.
authMethodPriority:
kind: parameter
group: producer
label: producer
type: string
javaType: java.lang.String
enum:
- Basic
- Digest
- NTLM
deprecated: false
secret: false
description: Authentication method for proxy either as Basic Digest or NTLM.
bridgeEndpoint:
kind: parameter
group: producer
label: producer
type: boolean
javaType: boolean
deprecated: false
secret: false
defaultValue: false
description: If the option is true HttpProducer will ignore the Exchange.HTTP_URI header and use the endpoint's URI for request. You may also set the option throwExceptionOnFailure to be false to let the HttpProducer send all the fault response back.
connectionClose:
kind: parameter
group: producer
label: producer
type: boolean
javaType: boolean
deprecated: false
secret: false
defaultValue: false
description: Specifies whether a Connection Close header must be added to HTTP Request. By default connectionClose is false.
copyHeaders:
kind: parameter
group: producer
label: producer
type: boolean
javaType: boolean
deprecated: false
secret: false
defaultValue: true
description: If this option is true then IN exchange headers will be copied to OUT exchange headers according to copy strategy. Setting this to false allows to only include the headers from the HTTP response (not propagating IN headers).
ignoreResponseBody:
kind: parameter
group: producer
label: producer
type: boolean
javaType: boolean
deprecated: false
secret: false
defaultValue: false
description: If this option is true The http producer won't read response body and cache the input stream
okStatusCodeRange:
kind: parameter
group: producer
label: producer
type: string
javaType: java.lang.String
deprecated: false
secret: false
defaultValue: 200-299
description: The status codes which is considered a success response. The values are inclusive. The range must be defined as from-to with the dash included.
preserveHostHeader:
kind: parameter
group: producer
label: producer
type: boolean
javaType: boolean
deprecated: false
secret: false
defaultValue: false
description: If the option is true HttpProducer will set the Host header to the value contained in the current exchange Host header useful in reverse proxy applications where you want the Host header received by the downstream server to reflect the URL called by the upstream client this allows applications which use the Host header to generate accurate URL's for a proxied service
proxyHost:
kind: parameter
group: producer
label: producer
type: string
javaType: java.lang.String
deprecated: false
secret: false
description: The proxy host name
proxyPort:
kind: parameter
group: producer
label: producer
type: integer
javaType: int
deprecated: false
secret: false
description: The proxy port number
throwExceptionOnFailure:
kind: parameter
group: producer
label: producer
type: boolean
javaType: boolean
deprecated: false
secret: false
defaultValue: true
description: Option to disable throwing the HttpOperationFailedException in case of failed responses from the remote server. This allows you to get all responses regardless of the HTTP status code.
urlRewrite:
kind: parameter
group: producer (advanced)
label: producer,advanced
type: object
javaType: org.apache.camel.http.common.UrlRewrite
deprecated: false
secret: false
description: Refers to a custom org.apache.camel.component.http.UrlRewrite which allows you to rewrite urls when you bridge/proxy endpoints. See more details at http://camel.apache.org/urlrewrite.html
mapHttpMessageBody:
kind: parameter
group: advanced
label: advanced
type: boolean
javaType: boolean
deprecated: false
secret: false
defaultValue: true
description: If this option is true then IN exchange Body of the exchange will be mapped to HTTP body. Setting this to false will avoid the HTTP mapping.
mapHttpMessageFormUrlEncodedBody:
kind: parameter
group: advanced
label: advanced
type: boolean
javaType: boolean
deprecated: false
secret: false
defaultValue: true
description: If this option is true then IN exchange Form Encoded body of the exchange will be mapped to HTTP. Setting this to false will avoid the HTTP Form Encoded body mapping.
mapHttpMessageHeaders:
kind: parameter
group: advanced
label: advanced
type: boolean
javaType: boolean
deprecated: false
secret: false
defaultValue: true
description: If this option is true then IN exchange Headers of the exchange will be mapped to HTTP headers. Setting this to false will avoid the HTTP Headers mapping.
synchronous:
kind: parameter
group: advanced
label: advanced
type: boolean
javaType: boolean
deprecated: false
secret: false
defaultValue: false
description: Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
documentation.adoc: |+
[[Atmosphere-Websocket-AtmosphereWebsocketServletComponent]]
Atmosphere Websocket Servlet Component
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*Available as of Camel 2.14*
The??*atmosphere-websocket:*??component provides Websocket
based??link:endpoint.html[endpoints]??for a servlet communicating with
external clients over Websocket (as a servlet accepting websocket
connections from external clients). +
The component uses the link:servlet.html[SERVLET] component and uses
the??https://github.com/Atmosphere/atmosphere[Atmosphere]??library to
support the Websocket transport in various Servlet containers (e..g.,
Jetty, Tomcat, ...).
Unlike the
https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=39621544[Websocket]
component that starts the embedded Jetty server, this component uses the
servlet provider of the container.
Maven users will need to add the following dependency to
their??`pom.xml`??for this component:
[source,xml]
------------------------------------------------------------
org.apache.camel
camel-atmosphere-websocket
x.x.x
------------------------------------------------------------
[[Atmosphere-Websocket-Options]]
Atmosphere-Websocket Options
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// component options: START
The Atmosphere Websocket component supports 7 options which are listed below.
{% raw %}
[width="100%",cols="2,1m,7",options="header"]
|=======================================================================
| Name | Java Type | Description
| servletName | String | Default name of servlet to use. The default name is CamelServlet.
| httpRegistry | HttpRegistry | To use a custom org.apache.camel.component.servlet.HttpRegistry.
| attachmentMultipartBinding | boolean | Whether to automatic bind multipart/form-data as attachments on the Camel Exchange. This is turn off by default as this may require servlet specific configuration to enable this when using Servlet's.
| httpBinding | HttpBinding | To use a custom HttpBinding to control the mapping between Camel message and HttpClient.
| httpConfiguration | HttpConfiguration | To use the shared HttpConfiguration as base configuration.
| allowJavaSerializedObject | boolean | Whether to allow java serialization when a request uses context-type=application/x-java-serialized-object This is by default turned off. If you enable this then be aware that Java will deserialize the incoming data from the request to Java and that can be a potential security risk.
| headerFilterStrategy | HeaderFilterStrategy | To use a custom HeaderFilterStrategy to filter header to and from Camel message.
|=======================================================================
{% endraw %}
// component options: END
// endpoint options: START
The Atmosphere Websocket component supports 35 endpoint options which are listed below:
{% raw %}
[width="100%",cols="2,1,1m,1m,5",options="header"]
|=======================================================================
| Name | Group | Default | Java Type | Description
| servicePath | common | | String | *Required* Name of websocket endpoint
| chunked | common | true | boolean | If this option is false the Servlet will disable the HTTP streaming and set the content-length header on the response
| disableStreamCache | common | false | boolean | Determines whether or not the raw input stream from Servlet is cached or not (Camel will read the stream into a in memory/overflow to file Stream caching) cache. By default Camel will cache the Servlet input stream to support reading it multiple times to ensure it Camel can retrieve all data from the stream. However you can set this option to true when you for example need to access the raw stream such as streaming it directly to a file or other persistent store. DefaultHttpBinding will copy the request input stream into a stream cache and put it into message body if this option is false to support reading the stream multiple times. If you use Servlet to bridge/proxy an endpoint then consider enabling this option to improve performance in case you do not need to read the message payload multiple times. The http/http4 producer will by default cache the response body stream. If setting this option to true then the producers will not cache the response body stream but use the response stream as-is as the message body.
| headerFilterStrategy | common | | HeaderFilterStrategy | To use a custom HeaderFilterStrategy to filter header to and from Camel message.
| httpBinding | common | | HttpBinding | To use a custom HttpBinding to control the mapping between Camel message and HttpClient.
| sendToAll | common | false | boolean | Whether to send to all (broadcast) or send to a single receiver.
| transferException | common | false | boolean | If enabled and an Exchange failed processing on the consumer side and if the caused Exception was send back serialized in the response as a application/x-java-serialized-object content type. On the producer side the exception will be deserialized and thrown as is instead of the HttpOperationFailedException. The caused exception is required to be serialized. This is by default turned off. If you enable this then be aware that Java will deserialize the incoming data from the request to Java and that can be a potential security risk.
| useStreaming | common | false | boolean | To enable streaming to send data as multiple text fragments.
| async | consumer | false | boolean | Configure the consumer to work in async mode
| bridgeErrorHandler | consumer | false | boolean | Allows for bridging the consumer to the Camel routing Error Handler which mean any exceptions occurred while the consumer is trying to pickup incoming messages or the likes will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions that will be logged at WARN/ERROR level and ignored.
| eagerCheckContentAvailable | consumer | false | boolean | Whether to eager check whether the HTTP requests has content if the content-length header is 0 or not present. This can be turned on in case HTTP clients do not send streamed data.
| httpMethodRestrict | consumer | | String | Used to only allow consuming if the HttpMethod matches such as GET/POST/PUT etc. Multiple methods can be specified separated by comma.
| matchOnUriPrefix | consumer | false | boolean | Whether or not the consumer should try to find a target consumer by matching the URI prefix if no exact match is found.
| optionsEnabled | consumer | false | boolean | Specifies whether to enable HTTP OPTIONS for this Servlet consumer. By default OPTIONS is turned off.
| responseBufferSize | consumer | | Integer | To use a custom buffer size on the javax.servlet.ServletResponse.
| servletName | consumer | CamelServlet | String | Name of the servlet to use
| traceEnabled | consumer | false | boolean | Specifies whether to enable HTTP TRACE for this Servlet consumer. By default TRACE is turned off.
| attachmentMultipartBinding | consumer (advanced) | false | boolean | Whether to automatic bind multipart/form-data as attachments on the Camel Exchange. This is turn off by default as this may require servlet specific configuration to enable this when using Servlet's.
| exceptionHandler | consumer (advanced) | | ExceptionHandler | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions that will be logged at WARN/ERROR level and ignored.
| exchangePattern | consumer (advanced) | | ExchangePattern | Sets the exchange pattern when the consumer creates an exchange.
| authMethodPriority | producer | | String | Authentication method for proxy either as Basic Digest or NTLM.
| bridgeEndpoint | producer | false | boolean | If the option is true HttpProducer will ignore the Exchange.HTTP_URI header and use the endpoint's URI for request. You may also set the option throwExceptionOnFailure to be false to let the HttpProducer send all the fault response back.
| connectionClose | producer | false | boolean | Specifies whether a Connection Close header must be added to HTTP Request. By default connectionClose is false.
| copyHeaders | producer | true | boolean | If this option is true then IN exchange headers will be copied to OUT exchange headers according to copy strategy. Setting this to false allows to only include the headers from the HTTP response (not propagating IN headers).
| ignoreResponseBody | producer | false | boolean | If this option is true The http producer won't read response body and cache the input stream
| okStatusCodeRange | producer | 200-299 | String | The status codes which is considered a success response. The values are inclusive. The range must be defined as from-to with the dash included.
| preserveHostHeader | producer | false | boolean | If the option is true HttpProducer will set the Host header to the value contained in the current exchange Host header useful in reverse proxy applications where you want the Host header received by the downstream server to reflect the URL called by the upstream client this allows applications which use the Host header to generate accurate URL's for a proxied service
| proxyHost | producer | | String | The proxy host name
| proxyPort | producer | | int | The proxy port number
| throwExceptionOnFailure | producer | true | boolean | Option to disable throwing the HttpOperationFailedException in case of failed responses from the remote server. This allows you to get all responses regardless of the HTTP status code.
| urlRewrite | producer (advanced) | | UrlRewrite | Refers to a custom org.apache.camel.component.http.UrlRewrite which allows you to rewrite urls when you bridge/proxy endpoints. See more details at http://camel.apache.org/urlrewrite.html
| mapHttpMessageBody | advanced | true | boolean | If this option is true then IN exchange Body of the exchange will be mapped to HTTP body. Setting this to false will avoid the HTTP mapping.
| mapHttpMessageFormUrlEncodedBody | advanced | true | boolean | If this option is true then IN exchange Form Encoded body of the exchange will be mapped to HTTP. Setting this to false will avoid the HTTP Form Encoded body mapping.
| mapHttpMessageHeaders | advanced | true | boolean | If this option is true then IN exchange Headers of the exchange will be mapped to HTTP headers. Setting this to false will avoid the HTTP Headers mapping.
| synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
|=======================================================================
{% endraw %}
// endpoint options: END
[[Atmosphere-Websocket-URIFormat]]
URI Format
^^^^^^^^^^
[source,java]
-----------------------------------------------
atmosphere-websocket:///relative path[?options]
-----------------------------------------------
[[Atmosphere-Websocket-ReadingandWritingDataoverWebsocket]]
Reading and Writing Data over Websocket
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
An atmopshere-websocket endpoint can either write data to the socket or
read from the socket, depending on whether the endpoint is configured as
the producer or the consumer, respectively.
[[Atmosphere-Websocket-ConfiguringURItoReadorWriteData]]
Configuring URI to Read or Write Data
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
In the route below, Camel will read from the specified websocket
connection.
[source,java]
-------------------------------------------
from("atmosphere-websocket:///servicepath")
.to("direct:next");
-------------------------------------------
And the equivalent Spring sample:
[source,xml]
------------------------------------------------------------
------------------------------------------------------------
In the route below, Camel will read from the specified websocket
connection.
[source,java]
---------------------------------------------------
from("direct:next")
.to("atmosphere-websocket:///servicepath");
---------------------------------------------------
And the equivalent Spring sample:
[source,xml]
------------------------------------------------------------
------------------------------------------------------------
??
[[Atmosphere-Websocket-SeeAlso]]
See Also
^^^^^^^^
* link:configuring-camel.html[Configuring Camel]
* link:component.html[Component]
* link:endpoint.html[Endpoint]
* link:getting-started.html[Getting Started]
* link:servlet.html[SERVLET]
* link:ahc-ws.html[AHC-WS]
*
https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=39621544[Websocket]