All Projects → TakeoffTech → clj-camel

TakeoffTech / clj-camel

Licence: Apache-2.0 license
The library adds a thin idiomatic layer on top of Java Apache Camel

Programming Languages

clojure
4091 projects
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to clj-camel

camel-lsp-client-vscode
This is a client implementation of the Apache Camel Language Server Protocol for Visual Studio Code
Stars: ✭ 24 (-36.84%)
Mutual labels:  camel, apache-camel
camel-language-server
The Apache Camel LSP server implementation
Stars: ✭ 31 (-18.42%)
Mutual labels:  camel, apache-camel
hawtio-integration
Core integration plugins for Hawtio: Apache ActiveMQ, Camel, Karaf, OSGi, and Spring Boot
Stars: ✭ 26 (-31.58%)
Mutual labels:  camel
akka-microservice
Example of a microservice with Scala, Akka, Spray and Camel/ActiveMQ
Stars: ✭ 45 (+18.42%)
Mutual labels:  camel
formula1-telemetry-kafka
No description or website provided.
Stars: ✭ 99 (+160.53%)
Mutual labels:  apache-camel
further-cdi
🔊 Going further with CDI presentation
Stars: ✭ 28 (-26.32%)
Mutual labels:  camel
camel-k-examples
Apache Camel K Examples
Stars: ✭ 48 (+26.32%)
Mutual labels:  camel
camel-kafka-connector-examples
Apache Camel Kafka Connector Examples
Stars: ✭ 45 (+18.42%)
Mutual labels:  camel
camel-cxfrs-example
Camel CXF Rest Example with JSON
Stars: ✭ 31 (-18.42%)
Mutual labels:  camel
jboss-fuse-examples
[Archived] Collection of JBoss Fuse 6 examples
Stars: ✭ 16 (-57.89%)
Mutual labels:  apache-camel
modules
Java & REST API's for creating and running integrations
Stars: ✭ 16 (-57.89%)
Mutual labels:  camel
pascalcase
Convert a string to pascal case (upper camel case). Used by more than 8.7 million projects on GitHub! Please follow this library's author: https://github.com/jonschlinkert
Stars: ✭ 35 (-7.89%)
Mutual labels:  camel
Camel
Apache Camel is an open source integration framework that empowers you to quickly and easily integrate various systems consuming or producing data.
Stars: ✭ 4,034 (+10515.79%)
Mutual labels:  camel
event-driven-microservices
No description or website provided.
Stars: ✭ 15 (-60.53%)
Mutual labels:  camel
camel-karavan
Karavan the Camel Integration Designer
Stars: ✭ 77 (+102.63%)
Mutual labels:  camel
camel-quarkus-examples
Apache Camel Quarkus Examples
Stars: ✭ 37 (-2.63%)
Mutual labels:  camel
camel-bindy-example
camel Bindy Example
Stars: ✭ 13 (-65.79%)
Mutual labels:  camel
kamel
Kotlin DSL for Apache Camel
Stars: ✭ 15 (-60.53%)
Mutual labels:  camel
camel-extra
Additional components for the Apache Camel integration framework
Stars: ✭ 32 (-15.79%)
Mutual labels:  camel

Clojure DSL for Apache Camel Clojure CI Clojars Project

Motivation

Camel is an open source integration framework that empowers you to quickly and easily integrate various systems consuming or producing data.

This library adds a thin layer on top of Java Apache Camel and provides a more idiomatic experience of using Apache Camel in the Clojure ecosystem, without changing the original functionality.

Installation

Include in your project.clj

Usage

(require [clj-camel.core :as c]
         [clj-camel.util :as cu])

Examples

Simple route

(c/route-builder (c/from "direct:test")
                 (c/route-id "test-route")
                 (c/set-body (c/constant "test-body"))
                 (c/log "log: ${body}")
                 (c/to "direct:result"))

Filter (original doc)

(c/route-builder (c/from "direct:test")
                 (c/route-id "test-route")
                 (c/to "http://test-http")
                 (c/filter (c/predicate (comp pos? :body))
                           (c/log "Filtered ... ${body}")
                           (c/to "direct:result"))
                 (c/process (fn [_] {:body "after filter"})))

Choice (original doc)

(c/route-builder (c/choice (c/when (c/predicate (comp pos? :body))
                                   (c/log "when 1")
                                   (c/process some-processor))
                           (c/when (c/predicate (comp neg? :body))
                                   (c/log "when 2")
                                   (c/process some-processor))
                           (c/otherwise
                             (c/log "otherwise")
                             (c/process some-processor)))
                 (c/log "after choice"))

Split (original doc)

(c/route-builder (c/from "direct:test")
                 (c/route-id "test-route")
                 (c/process processor1)
                 (c/to "http://test-http")
                 (c/split (c/json-path "$.data.*") {:agg-strategy        c/grouped-exchange-strategy
                                                    :streaming           true
                                                    :parallel-processing true}
                          (c/process (fn [_] {}))
                          (c/filter (c/predicate (comp pos? :reserved-today :body))
                                    (c/log "Filtered ... ${body}")
                                    (c/to "direct:result")))
                 (c/process (fn [_] {:body "after"})))

Aggregate (original doc)

(c/route-builder (c/from "direct:test")
                 (c/set-body (c/constant "test"))
                 (c/aggregate (c/constant 1) c/grouped-body-strategy
                              {:completion-size      1000
                               :completion-timeout   1000
                               :completion-predicate (c/predicate (fn [_] true))})
                 (c/log "after aggregating")
                 (c/to "direct:result"))

Caching (original doc)

(c/route-builder (c/from "direct:test")
                 (c/route-id "test-route")
                 (c/set-body (c/constant "key"))
                 (c/log "key requested: ${body}")
                 (c/memoize (cu/create-jcache-expiration-policy "cache-name" 60)
                            (c/set-body (c/constant "value"))
                            (c/log "Populate cache with ${body}"))
                 (c/log "key value result: ${body}")
                 (c/to "direct:result"))

Throttling (original doc)

(c/route-builder (c/from "direct:test")
                 (c/set-body (c/constant "test"))
                 (c/throttle 20 {:async-delayed      false
                                 :reject-execution   false
                                 :time-period-millis 10000})
                 (c/log "after throttling")
                 (c/to "direct:result"))

Try/Catch/Finally (original doc)

(c/route-builder (c/from "direct:test")
                 (c/route-id "test-route")
                 (c/do-try (c/to "http://test-http")
                           (c/do-catch Exception
                                       (c/log "handle exception")
                                       (c/log "handle exception2"))
                           (c/do-finally
                             (c/log "finally")
                             (c/log "finally2")))
                 (c/log "after do-try"))

MDC from headers UOW

The following will populate MDC context with name-of-mdc-field with value of incoming exchange header field name-of-header-field (if incoming exchange has a respective header)

Example of log:

{
  "message": "example message",
  "mdc": {
    "name-of-mdc-field": "test-value",
    "camel.breadcrumbId": "xxx",
    "camel.routeId": "yyy"
  }
}
(c/set-customer-uow-with-mdc-from-headers context {"name-of-header-filed" "name-of-mdc-field"})

GCP Pub-sub attributes propagation

Specified pub-sub message attributes will be added to exchange header if exist

(c/set-pubsub-attributes-propagation context {"pubsub-attribute-name" "name-of-header-field"})

Logging Configuration

When configuring your logging appenders, contrary to the Camel documentation, you will need to add clj-camel.core as your logging namespace.

Apache Camel 3.8 -> 3.11 Migration Notes

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].