--- apiVersion: v1 kind: List items: - apiVersion: v1 kind: ConfigMap metadata: labels: funktion.fabric8.io/kind: Connector provider: fabric8 project: connector-ahc-ws version: 1.1.41 group: io.fabric8.funktion.connector name: ahc-ws data: deployment.yml: | --- apiVersion: extensions/v1beta1 kind: Deployment metadata: labels: funktion.fabric8.io/kind: Subscription connector: ahc-ws spec: replicas: 1 template: metadata: labels: funktion.fabric8.io/kind: Subscription connector: ahc-ws spec: containers: - image: funktion/connector-ahc-ws:1.1.41 name: connector schema.yml: | --- component: kind: component scheme: ahc-ws extendsScheme: ahc alternativeSchemes: ahc-ws,ahc-wss syntax: ahc-ws:httpUri title: AHC Websocket description: To exchange data with external Websocket servers using Async Http Client. label: websocket deprecated: false async: true javaType: org.apache.camel.component.ahc.ws.WsComponent groupId: org.apache.camel artifactId: camel-ahc-ws version: 2.18.1 componentProperties: client: kind: property type: object javaType: org.asynchttpclient.AsyncHttpClient deprecated: false secret: false description: To use a custom AsyncHttpClient order: 0 binding: kind: property type: object javaType: org.apache.camel.component.ahc.AhcBinding deprecated: false secret: false description: To use a custom AhcBinding which allows to control how to bind between AHC and Camel. order: 1 clientConfig: kind: property type: object javaType: org.asynchttpclient.AsyncHttpClientConfig deprecated: false secret: false description: To configure the AsyncHttpClient to use a custom com.ning.http.client.AsyncHttpClientConfig instance. order: 2 sslContextParameters: kind: property type: object javaType: org.apache.camel.util.jsse.SSLContextParameters deprecated: false secret: false description: Reference to a org.apache.camel.util.jsse.SSLContextParameters in the Registry. Note that configuring this option will override any SSL/TLS configuration options provided through the clientConfig option at the endpoint or component level. order: 3 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. order: 4 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. order: 5 properties: httpUri: kind: path group: common required: true type: string javaType: java.net.URI deprecated: false secret: false description: The URI to use such as http://hostname:port/path order: 0 binding: kind: parameter group: common type: object javaType: org.apache.camel.component.ahc.AhcBinding deprecated: false secret: false description: To use a custom AhcBinding which allows to control how to bind between AHC and Camel. order: 1 bridgeEndpoint: kind: parameter group: common type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: If the option is true then the Exchange.HTTP_URI header is ignored and use the endpoint's URI for request. You may also set the throwExceptionOnFailure to be false to let the AhcProducer send all the fault response back. order: 2 bufferSize: kind: parameter group: common type: integer javaType: int deprecated: false secret: false defaultValue: "4096" description: The initial in-memory buffer size used when transferring data between Camel and AHC Client. order: 3 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. order: 4 throwExceptionOnFailure: kind: parameter group: common type: boolean javaType: boolean deprecated: false secret: false defaultValue: true description: Option to disable throwing the AhcOperationFailedException in case of failed responses from the remote server. This allows you to get all responses regardless of the HTTP status code. order: 5 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 (for example using Jetty or Servlet Camel components). On the producer side the exception will be deserialized and thrown as is instead of the AhcOperationFailedException. 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. order: 6 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. order: 7 sendMessageOnError: kind: parameter group: consumer label: consumer type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: Whether to send an message if the web-socket listener received an error. order: 8 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. order: 9 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. order: 10 connectionClose: kind: parameter group: producer label: producer type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: Define if the Connection Close header has to be added to HTTP Request. This parameter is false by default order: 11 useStreaming: kind: parameter group: producer label: producer type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: To enable streaming to send data as multiple text fragments. order: 12 clientConfig: kind: parameter group: advanced label: advanced type: object javaType: org.asynchttpclient.AsyncHttpClientConfig deprecated: false secret: false description: To configure the AsyncHttpClient to use a custom com.ning.http.client.AsyncHttpClientConfig instance. order: 13 clientConfigOptions: kind: parameter group: advanced label: advanced type: object javaType: java.util.Map prefix: asyncHttpClientConfig. multiValue: true deprecated: false secret: false description: To configure the AsyncHttpClientConfig using the key/values from the Map. order: 14 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). order: 15 sslContextParameters: kind: parameter group: security label: security type: object javaType: org.apache.camel.util.jsse.SSLContextParameters deprecated: false secret: false description: Reference to a org.apache.camel.util.jsse.SSLContextParameters in the Registry. This reference overrides any configured SSLContextParameters at the component level. See Using the JSSE Configuration Utility. Note that configuring this option will override any SSL/TLS configuration options provided through the clientConfig option at the endpoint or component level. order: 16 documentation.adoc: |+ [[AHC-WS-AsyncHttpClientWebsocketClientComponent]] Async Http Client (AHC) Websocket Client Component ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *Available as of Camel 2.14* The??*ahc-ws*??component provides Websocket based??link:endpoint.html[endpoints]??for a client communicating with external servers over Websocket (as a client opening a websocket connection to an external server). + The component uses the link:ahc.html[AHC] component that in turn uses the??https://github.com/AsyncHttpClient/async-http-client[Async Http Client]??library. Maven users will need to add the following dependency to their??`pom.xml`??for this component: [source,xml] ------------------------------------------------------------ org.apache.camel camel-ahc-ws x.x.x ------------------------------------------------------------ [[AHC-WS-URIFormat]] URI Format ^^^^^^^^^^ [source,java] ------------------------------------------------- ahc-ws://hostname[:port][/resourceUri][?options] ahc-wss://hostname[:port][/resourceUri][?options] ------------------------------------------------- Will by default use port 80 for ahc-ws and 443 for ahc-wss. [[AHC-WS-AHC-WSOptions]] AHC-WS Options ^^^^^^^^^^^^^^ As the AHC-WS component is based on the AHC component, you can use the various configuration options of the AHC component. // component options: START The AHC Websocket component supports 6 options which are listed below. {% raw %} [width="100%",cols="2,1m,7",options="header"] |======================================================================= | Name | Java Type | Description | client | AsyncHttpClient | To use a custom AsyncHttpClient | binding | AhcBinding | To use a custom AhcBinding which allows to control how to bind between AHC and Camel. | clientConfig | AsyncHttpClientConfig | To configure the AsyncHttpClient to use a custom com.ning.http.client.AsyncHttpClientConfig instance. | sslContextParameters | SSLContextParameters | Reference to a org.apache.camel.util.jsse.SSLContextParameters in the Registry. Note that configuring this option will override any SSL/TLS configuration options provided through the clientConfig option at the endpoint or component level. | 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 AHC Websocket component supports 17 endpoint options which are listed below: {% raw %} [width="100%",cols="2,1,1m,1m,5",options="header"] |======================================================================= | Name | Group | Default | Java Type | Description | httpUri | common | | URI | *Required* The URI to use such as http://hostname:port/path | binding | common | | AhcBinding | To use a custom AhcBinding which allows to control how to bind between AHC and Camel. | bridgeEndpoint | common | false | boolean | If the option is true then the Exchange.HTTP_URI header is ignored and use the endpoint's URI for request. You may also set the throwExceptionOnFailure to be false to let the AhcProducer send all the fault response back. | bufferSize | common | 4096 | int | The initial in-memory buffer size used when transferring data between Camel and AHC Client. | headerFilterStrategy | common | | HeaderFilterStrategy | To use a custom HeaderFilterStrategy to filter header to and from Camel message. | throwExceptionOnFailure | common | true | boolean | Option to disable throwing the AhcOperationFailedException in case of failed responses from the remote server. This allows you to get all responses regardless of the HTTP status code. | 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 (for example using Jetty or Servlet Camel components). On the producer side the exception will be deserialized and thrown as is instead of the AhcOperationFailedException. 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. | 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. | sendMessageOnError | consumer | false | boolean | Whether to send an message if the web-socket listener received an error. | 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. | connectionClose | producer | false | boolean | Define if the Connection Close header has to be added to HTTP Request. This parameter is false by default | useStreaming | producer | false | boolean | To enable streaming to send data as multiple text fragments. | clientConfig | advanced | | AsyncHttpClientConfig | To configure the AsyncHttpClient to use a custom com.ning.http.client.AsyncHttpClientConfig instance. | clientConfigOptions | advanced | | Map | To configure the AsyncHttpClientConfig using the key/values from the Map. | synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). | sslContextParameters | security | | SSLContextParameters | Reference to a org.apache.camel.util.jsse.SSLContextParameters in the Registry. This reference overrides any configured SSLContextParameters at the component level. See Using the JSSE Configuration Utility. Note that configuring this option will override any SSL/TLS configuration options provided through the clientConfig option at the endpoint or component level. |======================================================================= {% endraw %} // endpoint options: END [[AHC-WS-WritingandReadingDataoverWebsocket]] Writing and Reading Data over Websocket ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ An ahc-ws 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. [[AHC-WS-ConfiguringURItoWriteorReadData]] Configuring URI to Write or Read Data ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ In the route below, Camel will write to the specified websocket connection. [source,java] ----------------------------------- from("direct:start") .to("ahc-ws://targethost"); ----------------------------------- And the equivalent Spring sample: [source,xml] ------------------------------------------------------------ ------------------------------------------------------------ In the route below, Camel will read from the specified websocket connection. [source,java] --------------------------- from("ahc-ws://targethost") .to("direct:next"); --------------------------- And the equivalent Spring sample: [source,xml] ------------------------------------------------------------ ------------------------------------------------------------ ?? [[AHC-WS-SeeAlso]] See Also ^^^^^^^^ * link:configuring-camel.html[Configuring Camel] * link:component.html[Component] * link:endpoint.html[Endpoint] * link:getting-started.html[Getting Started] * link:../../../../camel-ahc/src/main/docs/readme.html[AHC] * link:atmosphere-websocket.html[Atmosphere-Websocket]