Fuse 6 is no longer supported
As of February 2025, Red Hat Fuse 6 is no longer supported. If you are using Fuse 6, please upgrade to Red Hat build of Apache Camel.이 콘텐츠는 선택한 언어로 제공되지 않습니다.
Chapter 7. avro
Avro Component 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
Available as of Camel 2.10
This component provides a dataformat for avro, which allows serialization and deserialization of messages using Apache Avro's bindary dataformat. Moreover, it provides support for Apache Avro's rpc, by providing producers and consumers endpoint for using avro over netty or http.
Maven users will need to add the following dependency to their
pom.xml
for this component:
Apache Avro Overview 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
Avro allows you to define message types and a protocol using a json like format and then generate java code for the specified types and messages. However, it doesn't enforce a schema first approach and you can create schema for your existing classes. An example of how a schema looks like is below.
You can easily generate classes from a schema, using maven, ant etc. More details can be found at the Apache Avro documentation.
Using the Avro data format 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
Using the avro data format is as easy as specifying that the class that you want to marshal or unmarshal in your route.
An alternative can be to specify the dataformat inisde the context and reference it from your route.
In the same manner you can umarshal using the avro data format.
Using Avro IPC in Camel 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
As mentioned above Avro also provides RPC support over multiple transports such as http and netty. Camel provides consumers and producers for these two transports.
avro:[transport]:[host]:[port]
avro:[transport]:[host]:[port]
The supported transport values are currently http or netty.
When using camel producers for avro ipc, the "in" message body needs to contain the arguments of the operation sepcified in the avro protocol. The response will be added in the body of the "out" message.
In a similar manner when using camel avro consumers for avro ipc, the requests arguments will be placed inside the "in" message body of the created exchange and once the exchange is processed the body of the "out" message will be send as a response.
Avro IPC URI Options 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
Name | Description |
---|---|
protocolClassName
|
The class name of the avro protocol. |
Avro IPC Headers 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
Name | Description |
---|---|
CamelAvroMessageName
|
The name of the message to send. |
Examples 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
An example of using camel avro producers via http:
An example of consuming messages using camel avro consumers via netty: