Iggy
Since Camel 4.14
Both producer and consumer are supported
The Iggy component is used for communicating with Iggy message broker.
Maven users will need to add the following dependency to their pom.xml for this component.
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-iggy</artifactId>
<version>x.x.x</version>
<!-- use the same version as your Camel core version -->
</dependency> Netty Version Requirement
The Iggy client library requires Netty 4.2.x or later. If your application uses an older version of Netty (e.g., 4.1.x), you will need to import the Netty 4.2.x BOM in your dependencyManagement section to ensure compatibility with the Iggy client:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-bom</artifactId>
<version>4.2.7.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement> Configuring Options
Camel components are configured on two separate levels:
-
component level
-
endpoint level
Configuring Component Options
At the component level, you set general and shared configurations that are, then, inherited by the endpoints. It is the highest configuration level.
For example, a component may have security settings, credentials for authentication, urls for network connection and so forth.
Some components only have a few options, and others may have many. Because components typically have pre-configured defaults that are commonly used, then you may often only need to configure a few options on a component; or none at all.
You can configure components using:
-
the Component DSL.
-
in a configuration file (
application.properties,*.yamlfiles, etc). -
directly in the Java code.
Configuring Endpoint Options
You usually spend more time setting up endpoints because they have many options. These options help you customize what you want the endpoint to do. The options are also categorized into whether the endpoint is used as a consumer (from), as a producer (to), or both.
Configuring endpoints is most often done directly in the endpoint URI as path and query parameters. You can also use the Endpoint DSL and DataFormat DSL as a type safe way of configuring endpoints and data formats in Java.
A good practice when configuring options is to use Property Placeholders.
Property placeholders provide a few benefits:
-
They help prevent using hardcoded urls, port numbers, sensitive information, and other settings.
-
They allow externalizing the configuration from the code.
-
They help the code to become more flexible and reusable.
The following two sections list all the options, firstly for the component followed by the endpoint.
Component Options
The Iggy component supports 27 options, which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
Whether to automatically create stream if it does not exist. | true | boolean | |
Whether to automatically create topic if it does not exist. | true | boolean | |
Polling strategy. Enum values:
| TCP | String | |
Compression algorithm for message payload. Enum values:
| None | CompressionAlgorithm | |
Allows to pre-configure the Iggy component with common options that the endpoints will reuse. | IggyConfiguration | ||
Iggy server hostname or IP address. | localhost | String | |
Maximum topic size in bytes (0 means unlimited). | 0 | Long | |
Message expiry time in seconds (0 means no expiry). | 0 | Long | |
Number of partitions for the topic. | 1 | Long | |
Iggy password. | String | ||
Iggy server port number. | 8090 | int | |
Replication factor for the topic. | Short | ||
Stream identifier. | Long | ||
Stream name. | String | ||
Controls message acknowledgment behavior. When true, messages are automatically marked as processed after consumption. When false, enables manual offset management and allows setting a custom starting offset position. | true | boolean | |
Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | |
The name of the consumer group. | String | ||
Camel Iggy consumers count. | 1 | int | |
The consumer partition id. | Long | ||
The consumer poll batch size. | 10 | Long | |
Polling strategy. Enum values:
| next | String | |
Camel Iggy shutdown timeout. | 30000 | int | |
Defines the initial message offset position when autoCommit is disabled. Use 0 to start from the beginning of the stream, or specify a custom offset to resume from a particular point. | 0 | Long | |
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean | |
Partitioning strategy for message distribution. | balanced | Partitioning | |
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. | true | boolean | |
Iggy username. | String |
Endpoint Options
The Iggy endpoint is configured using URI syntax:
iggy:topicName
With the following path and query parameters:
Query Parameters (27 parameters)
| Name | Description | Default | Type |
|---|---|---|---|
Whether to automatically create stream if it does not exist. | true | boolean | |
Whether to automatically create topic if it does not exist. | true | boolean | |
Polling strategy. Enum values:
| TCP | String | |
Compression algorithm for message payload. Enum values:
| None | CompressionAlgorithm | |
Iggy server hostname or IP address. | localhost | String | |
Maximum topic size in bytes (0 means unlimited). | 0 | Long | |
Message expiry time in seconds (0 means no expiry). | 0 | Long | |
Number of partitions for the topic. | 1 | Long | |
Iggy password. | String | ||
Iggy server port number. | 8090 | int | |
Replication factor for the topic. | Short | ||
Stream identifier. | Long | ||
Stream name. | String | ||
Controls message acknowledgment behavior. When true, messages are automatically marked as processed after consumption. When false, enables manual offset management and allows setting a custom starting offset position. | true | boolean | |
The name of the consumer group. | String | ||
Camel Iggy consumers count. | 1 | int | |
The consumer partition id. | Long | ||
The consumer poll batch size. | 10 | Long | |
Polling strategy. Enum values:
| next | String | |
Camel Iggy shutdown timeout. | 30000 | int | |
Defines the initial message offset position when autoCommit is disabled. Use 0 to start from the beginning of the stream, or specify a custom offset to resume from a particular point. | 0 | Long | |
Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | |
To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. | ExceptionHandler | ||
Sets the exchange pattern when the consumer creates an exchange. Enum values:
| ExchangePattern | ||
Partitioning strategy for message distribution. | balanced | Partitioning | |
Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | boolean | |
Iggy username. | String |
Iggy Headers
The following headers are set on the exchange when consuming messages from Iggy:
| Header | Type | Description |
|---|---|---|
|
| The unique identifier of the message. |
|
| The offset of the message in the partition. |
|
| The timestamp of the message. |
|
| The original timestamp of the message. |
|
| The checksum of the message. |
|
| The length of the message. |
|
| The size of the message. |
Examples
Consuming messages from Iggy
Here is a minimal route to read messages from an Iggy topic:
from("iggy:my_topic?streamName=my_stream&consumerGroupName=my_consumer_group&host=localhost&port=8090")
.log("Message received from Iggy : ${body}")
.log(" with id ${headers[CamelIggyMessageId]}")
.log(" and offset ${headers[CamelIggyMessageOffset]}");