Receiving Messages from RabbitMQ and Sending Citeck Event

The example demonstrates a basic integration scenario via RabbitMQ:

  1. Connecting to a RabbitMQ queue using credentials from an ECOS Endpoint.

  2. Removing RabbitMQ service headers before further processing.

  3. Logging the incoming message.

  4. Publishing a Citeck event with the body formed from the message body.

Note

To run this example, you need to:

  • Create a secret (Model → Secrets) with the connection data for RabbitMQ.

  • Create an endpoint (Model → Endpoints) with id rabbitmq-endpoint and specify the created secret.

  • Go to the Camel DSL journal (Integration - Camel DSL) and create a new context with the following config:

- beans:
    # Бин подключения к RabbitMQ на основе данных из ECOS Endpoint
    - name: rabbitConnectionFactory
      type: org.springframework.amqp.rabbit.connection.CachingConnectionFactory
      properties:
        uri: '{{ecos-endpoint:rabbitmq-endpoint/url}}'
        username: '{{ecos-endpoint:rabbitmq-endpoint/credentials/username}}'
        password: '{{ecos-endpoint:rabbitmq-endpoint/credentials/password}}'

- route:
    from:
      # "default" — дефолтный exchange в RabbitMQ (обычно обозначается пустой строкой,
      # но Camel требует явного значения "default")
      uri: "spring-rabbitmq:default"
      parameters:
        connectionFactory: '#bean:rabbitConnectionFactory'
        queues: test-queue
      steps:
        # Удаление заголовков RabbitMQ — актуально, если сообщение будет переотправлено в RMQ
        - removeHeaders:
            pattern: "CamelRabbitmq*"
        # Логирование входящего сообщения
        - to: "log:rmq-test"
        # Отправка события типа "test-event-type".
        # В теле передаётся DataValue.of(exchange.message.body)
        - to: "ecos-event:test-event-type"