--- apiVersion: v1 kind: List items: - apiVersion: v1 kind: ConfigMap metadata: labels: funktion.fabric8.io/kind: Connector provider: fabric8 project: connector-cometd version: 1.1.20 group: io.fabric8.funktion.connector name: cometd data: deployment.yml: | --- apiVersion: extensions/v1beta1 kind: Deployment metadata: labels: funktion.fabric8.io/kind: Subscription connector: cometd spec: replicas: 1 template: metadata: labels: funktion.fabric8.io/kind: Subscription connector: cometd spec: containers: - image: fabric8/connector-cometd:1.1.20 name: connector schema.yml: | --- component: kind: component scheme: cometd alternativeSchemes: cometd,cometds syntax: cometd:host:port/channelName title: CometD description: The cometd component is a transport for working with the Jetty implementation of the cometd/bayeux protocol. label: websocket deprecated: false async: false javaType: org.apache.camel.component.cometd.CometdComponent groupId: org.apache.camel artifactId: camel-cometd version: 2.18.1 componentProperties: sslKeyPassword: kind: property type: string javaType: java.lang.String deprecated: false secret: false description: The password for the keystore when using SSL. sslPassword: kind: property type: string javaType: java.lang.String deprecated: false secret: false description: The password when using SSL. sslKeystore: kind: property type: string javaType: java.lang.String deprecated: false secret: false description: The path to the keystore. securityPolicy: kind: property type: object javaType: org.cometd.bayeux.server.SecurityPolicy deprecated: false secret: false description: To use a custom configured SecurityPolicy to control authorization extensions: kind: property type: array javaType: java.util.List deprecated: false secret: false description: To use a list of custom BayeuxServer.Extension that allows modifying incoming and outgoing requests. sslContextParameters: kind: property type: object javaType: org.apache.camel.util.jsse.SSLContextParameters deprecated: false secret: false description: To configure security using SSLContextParameters properties: host: kind: path group: common required: true type: string javaType: java.lang.String deprecated: false secret: false description: Hostname port: kind: path group: common required: true type: integer javaType: int deprecated: false secret: false description: Host port number channelName: kind: path group: common required: true type: string javaType: java.lang.String deprecated: false secret: false description: The channelName represents a topic that can be subscribed to by the Camel endpoints. allowedOrigins: kind: parameter group: common type: string javaType: java.lang.String deprecated: false secret: false defaultValue: '*' description: The origins domain that support to cross if the crosssOriginFilterOn is true baseResource: kind: parameter group: common type: string javaType: java.lang.String deprecated: false secret: false description: 'The root directory for the web resources or classpath. Use the protocol file: or classpath: depending if you want that the component loads the resource from file system or classpath. Classpath is required for OSGI deployment where the resources are packaged in the jar' crossOriginFilterOn: kind: parameter group: common type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: If true the server will support for cross-domain filtering filterPath: kind: parameter group: common type: string javaType: java.lang.String deprecated: false secret: false description: The filterPath will be used by the CrossOriginFilter if the crosssOriginFilterOn is true interval: kind: parameter group: common type: integer javaType: int deprecated: false secret: false description: The client side poll timeout in milliseconds. How long a client will wait between reconnects jsonCommented: kind: parameter group: common type: boolean javaType: boolean deprecated: false secret: false defaultValue: true description: If true the server will accept JSON wrapped in a comment and will generate JSON wrapped in a comment. This is a defence against Ajax Hijacking. logLevel: kind: parameter group: common type: string javaType: int enum: - "0" - "1" - "2" deprecated: false secret: false defaultValue: "1" description: Logging level. 0=none 1=info 2=debug. maxInterval: kind: parameter group: common type: integer javaType: int deprecated: false secret: false defaultValue: "30000" description: The max client side poll timeout in milliseconds. A client will be removed if a connection is not received in this time. multiFrameInterval: kind: parameter group: common type: integer javaType: int deprecated: false secret: false defaultValue: "1500" description: The client side poll timeout if multiple connections are detected from the same browser. timeout: kind: parameter group: common type: integer javaType: int deprecated: false secret: false defaultValue: "240000" description: The server side poll timeout in milliseconds. This is how long the server will hold a reconnect request before responding. 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. sessionHeadersEnabled: kind: parameter group: consumer label: consumer type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: Whether to include the server session headers in the Camel message when creating a Camel Message for incoming requests. 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. disconnectLocalSession: kind: parameter group: producer label: producer type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: Whether to disconnect local sessions after publishing a message to its channel. Disconnecting local session is needed as they are not swept by default by CometD and therefore you can run out of memory. 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: |+ [[Cometd-CometdComponent]] Cometd Component ~~~~~~~~~~~~~~~~ The *cometd:* component is a transport for working with the http://www.mortbay.org/jetty[jetty] implementation of the http://docs.codehaus.org/display/JETTY/Cometd+%28aka+Bayeux%29[cometd/bayeux protocol]. + Using this component in combination with the dojo toolkit library it's possible to push Camel messages directly into the browser using an AJAX based mechanism. Maven users will need to add the following dependency to their `pom.xml` for this component: [source,xml] ------------------------------------------------------------ org.apache.camel camel-cometd x.x.x ------------------------------------------------------------ [[Cometd-URIformat]] URI format ^^^^^^^^^^ [source,java] ---------------------------------------- cometd://host:port/channelName[?options] ---------------------------------------- The *channelName* represents a topic that can be subscribed to by the Camel endpoints. [[Cometd-Examples]] Examples ^^^^^^^^ ------------------------------------------ cometd://localhost:8080/service/mychannel cometds://localhost:8443/service/mychannel ------------------------------------------ where `cometds:` represents an SSL configured endpoint. [[Cometd-Options]] Options ^^^^^^^ // component options: START The CometD component supports 6 options which are listed below. {% raw %} [width="100%",cols="2,1m,7",options="header"] |======================================================================= | Name | Java Type | Description | sslKeyPassword | String | The password for the keystore when using SSL. | sslPassword | String | The password when using SSL. | sslKeystore | String | The path to the keystore. | securityPolicy | SecurityPolicy | To use a custom configured SecurityPolicy to control authorization | extensions | List | To use a list of custom BayeuxServer.Extension that allows modifying incoming and outgoing requests. | sslContextParameters | SSLContextParameters | To configure security using SSLContextParameters |======================================================================= {% endraw %} // component options: END // endpoint options: START The CometD component supports 19 endpoint options which are listed below: {% raw %} [width="100%",cols="2,1,1m,1m,5",options="header"] |======================================================================= | Name | Group | Default | Java Type | Description | host | common | | String | *Required* Hostname | port | common | | int | *Required* Host port number | channelName | common | | String | *Required* The channelName represents a topic that can be subscribed to by the Camel endpoints. | allowedOrigins | common | * | String | The origins domain that support to cross if the crosssOriginFilterOn is true | baseResource | common | | String | The root directory for the web resources or classpath. Use the protocol file: or classpath: depending if you want that the component loads the resource from file system or classpath. Classpath is required for OSGI deployment where the resources are packaged in the jar | crossOriginFilterOn | common | false | boolean | If true the server will support for cross-domain filtering | filterPath | common | | String | The filterPath will be used by the CrossOriginFilter if the crosssOriginFilterOn is true | interval | common | | int | The client side poll timeout in milliseconds. How long a client will wait between reconnects | jsonCommented | common | true | boolean | If true the server will accept JSON wrapped in a comment and will generate JSON wrapped in a comment. This is a defence against Ajax Hijacking. | logLevel | common | 1 | int | Logging level. 0=none 1=info 2=debug. | maxInterval | common | 30000 | int | The max client side poll timeout in milliseconds. A client will be removed if a connection is not received in this time. | multiFrameInterval | common | 1500 | int | The client side poll timeout if multiple connections are detected from the same browser. | timeout | common | 240000 | int | The server side poll timeout in milliseconds. This is how long the server will hold a reconnect request before responding. | 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. | sessionHeadersEnabled | consumer | false | boolean | Whether to include the server session headers in the Camel message when creating a Camel Message for incoming requests. | 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. | disconnectLocalSession | producer | false | boolean | Whether to disconnect local sessions after publishing a message to its channel. Disconnecting local session is needed as they are not swept by default by CometD and therefore you can run out of memory. | 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 You can append query options to the URI in the following format, `?option=value&option=value&...` Here is some examples on How to pass the parameters For file (for webapp resources located in the Web Application directory --> cometd://localhost:8080?resourceBase=file./webapp + For classpath (when by example the web resources are packaged inside the webapp folder --> cometd://localhost:8080?resourceBase=classpath:webapp [[Cometd-Authentication]] Authentication ^^^^^^^^^^^^^^ *Available as of Camel 2.8* You can configure custom `SecurityPolicy` and `Extension`'s to the `CometdComponent` which allows you to use authentication as http://cometd.org/documentation/howtos/authentication[documented here] [[Cometd-SettingupSSLforCometdComponent]] Setting up SSL for Cometd Component ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [[Cometd-UsingtheJSSEConfigurationUtility]] Using the JSSE Configuration Utility ++++++++++++++++++++++++++++++++++++ As of Camel 2.9, the Cometd component supports SSL/TLS configuration through the link:camel-configuration-utilities.html[Camel JSSE Configuration Utility].?? This utility greatly decreases the amount of component specific code you need to write and is configurable at the endpoint and component levels.?? The following examples demonstrate how to use the utility with the Cometd component. You need to configure SSL on the CometdComponent. [[Cometd-Programmaticconfigurationofthecomponent]] Programmatic configuration of the component [source,java] ----------------------------------------------------------------------------------------------- KeyStoreParameters ksp = new KeyStoreParameters(); ksp.setResource("/users/home/server/keystore.jks"); ksp.setPassword("keystorePassword"); KeyManagersParameters kmp = new KeyManagersParameters(); kmp.setKeyStore(ksp); kmp.setKeyPassword("keyPassword"); TrustManagersParameters tmp = new TrustManagersParameters(); tmp.setKeyStore(ksp); SSLContextParameters scp = new SSLContextParameters(); scp.setKeyManagers(kmp); scp.setTrustManagers(tmp); CometdComponent commetdComponent = getContext().getComponent("cometds", CometdComponent.class); commetdComponent.setSslContextParameters(scp); ----------------------------------------------------------------------------------------------- [[Cometd-SpringDSLbasedconfigurationofendpoint]] Spring DSL based configuration of endpoint [source,xml] ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ... ... ?? ... ... ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ [[Cometd-SeeAlso]] See Also ^^^^^^^^ * link:configuring-camel.html[Configuring Camel] * link:component.html[Component] * link:endpoint.html[Endpoint] * link:getting-started.html[Getting Started]