Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@
"keyType": { "kind": "property", "displayName": "Key Type", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.ehcache.EhcacheConfiguration", "configurationField": "configuration", "description": "The cache key type, default java.lang.Object" },
"valueType": { "kind": "property", "displayName": "Value Type", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.ehcache.EhcacheConfiguration", "configurationField": "configuration", "description": "The cache value type, default java.lang.Object" }
},
"headers": {
"CamelEhcacheAction": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The operation to be performed on the cache, valid options are:\n\n* CLEAR\n* PUT\n* PUT_ALL\n* PUT_IF_ABSENT\n* GET\n* GET_ALL\n* REMOVE\n* REMOVE_ALL\n* REPLACE" },
"CamelEhcacheActionHasResult": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Set to true if the action has a result" },
"CamelEhcacheActionSucceeded": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Set to true if the action was successful" },
"CamelEhcacheKey": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "Object", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The cache key used for an action" },
"CamelEhcacheKeys": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "Set<Object>", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "A list of keys, used in\n\n* PUT_ALL\n* GET_ALL\n* REMOVE_ALL" },
"CamelEhcacheValue": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "Object", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The value to put in the cache or the result of an operation" },
"CamelEhcacheOldValue": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "Object", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The old value associated to a key for actions like PUT_IF_ABSENT or the\nObject used for comparison for actions like REPLACE" },
"CamelEhcacheEventType": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "EventType", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The type of event received" }
},
"properties": {
"cacheName": { "kind": "path", "displayName": "Cache Name", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "the cache name" },
"cacheManager": { "kind": "parameter", "displayName": "Cache Manager", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.ehcache.CacheManager", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.ehcache.EhcacheConfiguration", "configurationField": "configuration", "description": "The cache manager" },
Expand Down
43 changes: 3 additions & 40 deletions components/camel-ehcache/src/main/docs/ehcache-component.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -51,46 +51,9 @@ include::partial$component-endpoint-options.adoc[]

// endpoint options: END



=== Message Headers Camel


[width="100%",cols="10%,10%,80%",options="header",]
|=======================================================================
|Header |Type |Description

|CamelEhcacheAction |`String` |The operation to be perfomed on the cache, valid options are:

* CLEAR
* PUT
* PUT_ALL
* PUT_IF_ABSENT
* GET
* GET_ALL
* REMOVE
* REMOVE_ALL
* REPLACE

|CamelEhcacheActionHasResult |Boolean |Set to true if the action has a result

|CamelEhcacheActionSucceeded |`Boolean` |Set to true if the actionsuccedded

|CamelEhcacheKey |Object |The cache key used for an action

|CamelEhcacheKeys |Set<Object> |A list of keys, used in

* PUT_ALL
* GET_ALL
* REMOVE_ALL

|CamelEhcacheValue |Object |The value to put in the cache or the result of an operation

|CamelEhcacheOldValue |Object |The old value associated to a key for actions like PUT_IF_ABSENT or the
Object used for comparison for actions like REPLACE

|CamelEhcacheEventType |EventType |The type of event received
|=======================================================================
// component headers: START
include::partial$component-endpoint-headers.adoc[]
// component headers: END

== Ehcache based idempotent repository example:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,42 @@
*/
package org.apache.camel.component.ehcache;

import org.apache.camel.spi.Metadata;

public interface EhcacheConstants {
@Metadata(description = "The operation to be performed on the cache, valid options are:\n" +
"\n" +
"* CLEAR\n" +
"* PUT\n" +
"* PUT_ALL\n" +
"* PUT_IF_ABSENT\n" +
"* GET\n" +
"* GET_ALL\n" +
"* REMOVE\n" +
"* REMOVE_ALL\n" +
"* REPLACE",
javaType = "String")
String ACTION = "CamelEhcacheAction";
@Metadata(description = "Set to true if the action has a result", javaType = "Boolean")
String ACTION_HAS_RESULT = "CamelEhcacheActionHasResult";
@Metadata(description = "Set to true if the action was successful", javaType = "Boolean")
String ACTION_SUCCEEDED = "CamelEhcacheActionSucceeded";
@Metadata(description = "The cache key used for an action", javaType = "Object")
String KEY = "CamelEhcacheKey";
@Metadata(description = "A list of keys, used in\n" +
"\n" +
"* PUT_ALL\n" +
"* GET_ALL\n" +
"* REMOVE_ALL\n",
javaType = "Set<Object>")
String KEYS = "CamelEhcacheKeys";
@Metadata(description = "The value to put in the cache or the result of an operation", javaType = "Object")
String VALUE = "CamelEhcacheValue";
@Metadata(description = "The old value associated to a key for actions like PUT_IF_ABSENT or the\n" +
"Object used for comparison for actions like REPLACE",
javaType = "Object")
String OLD_VALUE = "CamelEhcacheOldValue";
@Metadata(description = "The type of event received", javaType = "EventType")
String EVENT_TYPE = "CamelEhcacheEventType";

String ACTION_CLEAR = "CLEAR";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* Perform caching operations using <a href="http://www.ehcache.org">Ehcache</a>.
*/
@UriEndpoint(firstVersion = "2.18.0", scheme = "ehcache", title = "Ehcache", syntax = "ehcache:cacheName",
category = { Category.CACHE, Category.DATAGRID, Category.CLUSTERING })
category = { Category.CACHE, Category.DATAGRID, Category.CLUSTERING }, headersClass = EhcacheConstants.class)
public class EhcacheEndpoint extends DefaultEndpoint {

private static final Logger LOGGER = LoggerFactory.getLogger(EhcacheComponent.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@
"password": { "kind": "property", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "description": "Password for authenticate" },
"user": { "kind": "property", "displayName": "User", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "description": "Basic authenticate user" }
},
"headers": {
"operation": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "org.apache.camel.component.elasticsearch.ElasticsearchOperation", "enum": [ "Index", "Update", "Bulk", "BulkIndex", "GetById", "MultiGet", "MultiSearch", "Delete", "DeleteIndex", "Search", "Exists", "Ping" ], "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The operation to perform" },
"indexId": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The id of the indexed document." },
"indexName": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The name of the index to act against" },
"waitForActiveShards": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The index creation waits for the write consistency number of shards to be available" },
"scrollKeepAliveMs": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The starting index of the response." },
"useScroll": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Boolean", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Set to true to enable scroll usage" },
"size": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The size of the response." },
"from": { "kind": "header", "displayName": "", "group": "producer", "label": "", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The starting index of the response." }
},
"properties": {
"clusterName": { "kind": "path", "displayName": "Cluster Name", "group": "producer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.elasticsearch.ElasticsearchConfiguration", "configurationField": "configuration", "description": "Name of the cluster" },
"connectionTimeout": { "kind": "parameter", "displayName": "Connection Timeout", "group": "producer", "label": "", "required": false, "type": "integer", "javaType": "int", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 30000, "configurationClass": "org.apache.camel.component.elasticsearch.ElasticsearchConfiguration", "configurationField": "configuration", "description": "The time in ms to wait before connection will timeout." },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ include::partial$component-endpoint-options.adoc[]

// endpoint options: END


// component headers: START
include::partial$component-endpoint-headers.adoc[]
// component headers: END

== Message Operations

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,27 @@
*/
package org.apache.camel.component.elasticsearch;

import org.apache.camel.spi.Metadata;

public interface ElasticsearchConstants {

@Metadata(description = "The operation to perform",
javaType = "org.apache.camel.component.elasticsearch.ElasticsearchOperation")
String PARAM_OPERATION = "operation";
@Metadata(description = "The id of the indexed document.", javaType = "String")
String PARAM_INDEX_ID = "indexId";
@Metadata(description = "The name of the index to act against", javaType = "String")
String PARAM_INDEX_NAME = "indexName";
@Metadata(description = "The index creation waits for the write consistency number of shards to be available",
javaType = "Integer")
String PARAM_WAIT_FOR_ACTIVE_SHARDS = "waitForActiveShards";
@Metadata(description = "The starting index of the response.", javaType = "Integer")
String PARAM_SCROLL_KEEP_ALIVE_MS = "scrollKeepAliveMs";
@Metadata(description = "Set to true to enable scroll usage", javaType = "Boolean")
String PARAM_SCROLL = "useScroll";
@Metadata(description = "The size of the response.", javaType = "Integer")
String PARAM_SIZE = "size";
@Metadata(description = "The starting index of the response.", javaType = "Integer")
String PARAM_FROM = "from";

String PROPERTY_SCROLL_ES_QUERY_COUNT = "CamelElasticsearchScrollQueryCount";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*/
@UriEndpoint(firstVersion = "2.21.0", scheme = "elasticsearch-rest", title = "Elasticsearch Rest",
syntax = "elasticsearch-rest:clusterName", producerOnly = true,
category = { Category.SEARCH, Category.MONITORING })
category = { Category.SEARCH, Category.MONITORING }, headersClass = ElasticsearchConstants.class)
public class ElasticsearchEndpoint extends DefaultEndpoint {

@UriParam
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
"autowiredEnabled": { "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc." },
"elSqlConfig": { "kind": "property", "displayName": "El Sql Config", "group": "advanced", "label": "advanced", "required": false, "type": "object", "javaType": "com.opengamma.elsql.ElSqlConfig", "deprecated": false, "autowired": false, "secret": false, "description": "To use a specific configured ElSqlConfig. It may be better to use the databaseVendor option instead." }
},
"headers": {
"CamelSqlUpdateCount": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The number of rows updated for `update` operations, returned as an\n`Integer` object." },
"CamelSqlRowCount": { "kind": "header", "displayName": "", "group": "common", "label": "", "required": false, "javaType": "Integer", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The number of rows returned for `select` operations, returned as an\n`Integer` object." }
},
"properties": {
"elsqlName": { "kind": "path", "displayName": "Elsql Name", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The name of the elsql to use (is NAMED in the elsql file)" },
"resourceUri": { "kind": "path", "displayName": "Resource Uri", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "The resource file which contains the elsql SQL statements to use. You can specify multiple resources separated by comma. The resources are loaded on the classpath by default, you can prefix with file: to load from file system. Notice you can set this option on the component and then you do not have to configure this on the endpoint." },
Expand Down
20 changes: 3 additions & 17 deletions components/camel-elsql/src/main/docs/elsql-component.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ include::partial$component-endpoint-options.adoc[]
// endpoint options: START

// endpoint options: END

// component headers: START
include::partial$component-endpoint-headers.adoc[]
// component headers: END

== Result of the query

Expand All @@ -87,22 +89,6 @@ headers, it provides a concise syntax for querying a sequence or some
other small value into a header. It is convenient to use outputHeader
and outputType together:

== Header values

When performing `update` operations, the SQL Component stores the update
count in the following message headers:

[width="100%",cols="10%,90%",options="header",]
|===
|Header |Description

|`CamelSqlUpdateCount` |The number of rows updated for `update` operations, returned as an
`Integer` object.

|`CamelSqlRowCount` |The number of rows returned for `select` operations, returned as an
`Integer` object.
|===

=== Sample

In the given route below, we want to get all the projects from the
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.camel.component.elsql;

import org.apache.camel.component.sql.SqlConstants;
import org.apache.camel.spi.Metadata;

public final class ElsqlConstants {

@Metadata(label = "producer", description = "The number of rows updated for `update` operations, returned as an\n" +
"`Integer` object.",
javaType = "Integer")
public static final String SQL_UPDATE_COUNT = SqlConstants.SQL_UPDATE_COUNT;
@Metadata(label = "producer", description = "The number of rows returned for `select` operations, returned as an\n" +
"`Integer` object.",
javaType = "Integer")
public static final String SQL_ROW_COUNT = SqlConstants.SQL_ROW_COUNT;

private ElsqlConstants() {
// Utility class
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
* Use ElSql to define SQL queries. Extends the SQL Component.
*/
@UriEndpoint(firstVersion = "2.16.0", scheme = "elsql", title = "ElSQL", syntax = "elsql:elsqlName:resourceUri",
category = { Category.DATABASE, Category.SQL })
category = { Category.DATABASE, Category.SQL }, headersClass = ElsqlConstants.class)
public class ElsqlEndpoint extends DefaultSqlEndpoint {

private static final Logger LOG = LoggerFactory.getLogger(ElsqlEndpoint.class);
Expand Down
Loading