Yandex Yatomata Camel

Camel integration for Yatomata FSM

Лицензия

Лицензия

Категории

Категории

Dex Универсальные библиотеки Utility
Группа

Группа

ru.yandex.qatools
Идентификатор

Идентификатор

yatomata-camel
Последняя версия

Последняя версия

1.2
Дата

Дата

Тип

Тип

jar
Описание

Описание

Yandex Yatomata Camel
Camel integration for Yatomata FSM
Ссылка на сайт

Ссылка на сайт

https://github.com/camelot-framework/yatomata-camel
Организация-разработчик

Организация-разработчик

Yandex
Система контроля версий

Система контроля версий

https://github.com/camelot-framework/yatomata-camel

Скачать yatomata-camel

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/ru.yandex.qatools/yatomata-camel/ -->
<dependency>
    <groupId>ru.yandex.qatools</groupId>
    <artifactId>yatomata-camel</artifactId>
    <version>1.2</version>
</dependency>
// https://jarcasting.com/artifacts/ru.yandex.qatools/yatomata-camel/
implementation 'ru.yandex.qatools:yatomata-camel:1.2'
// https://jarcasting.com/artifacts/ru.yandex.qatools/yatomata-camel/
implementation ("ru.yandex.qatools:yatomata-camel:1.2")
'ru.yandex.qatools:yatomata-camel:jar:1.2'
<dependency org="ru.yandex.qatools" name="yatomata-camel" rev="1.2">
  <artifact name="yatomata-camel" type="jar" />
</dependency>
@Grapes(
@Grab(group='ru.yandex.qatools', module='yatomata-camel', version='1.2')
)
libraryDependencies += "ru.yandex.qatools" % "yatomata-camel" % "1.2"
[ru.yandex.qatools/yatomata-camel "1.2"]

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
ru.yandex.qatools : yatomata jar 1.6
org.slf4j : slf4j-api jar 1.7.7
org.apache.camel : camel-core jar 2.13.2

provided (4)

Идентификатор библиотеки Тип Версия
org.apache.camel : camel-spring jar 2.13.2
org.springframework : spring-core jar 3.2.11.RELEASE
org.springframework : spring-context jar 3.2.11.RELEASE
org.springframework : spring-beans jar 3.2.11.RELEASE

test (9)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.11
org.hamcrest : hamcrest-all jar 1.3
org.mockito : mockito-all jar 1.9.5
ru.yandex.qatools.allure : allure-junit-adaptor jar 1.4.8
org.apache.camel : camel-test jar 2.13.2
org.apache.camel : camel-test-spring jar 2.13.2
org.apache.camel : camel-jms jar 2.13.2
org.apache.activemq : activemq-camel jar 5.10.0
org.springframework : spring-jms jar 3.2.11.RELEASE

Модули Проекта

Данный проект не имеет модулей.

Yatomata Camel integration

This project aims to provide the ability to use Yatomata along with Camel.

User Guide

Setup

Add the following dependency to pom.xml of your Camel project:

    <dependency>
        <groupId>ru.yandex.qatools</groupId>
        <artifactId>yatomata-camel</artifactId>
        <version>1.0</version>
    </dependency>

Basics

Create the FSM class (for more information see Yatomata docs):

    @FSM(start = Stopped.class)
    @Transitions({
            @Transit(from = Stopped.class, on = Run.class, to = Running.class),
            @Transit(from = Running.class, on = Stop.class, to = Stopped.class, stop = true),
    })
    public class MyFSM {

    }

Add the aggregator bean to your Spring context:

    <bean id="myFSM" class="ru.yandex.qatools.fsm.camel.YatomataAggregationStrategy">
        <constructor-arg value="com.me.MyFSM"/>
    </bean>

Now you can use myFSM as an ordinary aggregation strategy:

    <aggregate strategyRef="myFSM">
        <correlationExpression>
            <simple>${in.body.uuid}</simple>
        </correlationExpression>
        <completionPredicate>
            <method bean="myFSM" method="isCompleted"/>
        </completionPredicate>
        <to uri="seda:queue:done"/>
    </aggregate>

You can also use the more declarative processors with the @Processor annotation. Create the processor class, declaring the separate methods for every body type of your message:

public class MyProcessor {
    @Processor(bodyType = String.class)
    public String process(@Body String body) {
        return body + "processed";
    }
}

Add the processor bean to your Spring context:

    <bean id="myProcessor" class="ru.yandex.qatools.fsm.camel.PluggableProcessor">
        <constructor-arg>
            <bean class="com.me.MyProcessor"/>
        </constructor-arg>
    </bean>

Now you can use myProcessor as an ordinary processor in your camel routes:

    <process ref="myProcessor"/>

Camel context injection

You can use @InjectHeader and @InjectHeaders annotations to inject the current exchange context into your FSM:

    @InjectHeader("headerName")
    String headerValue;

    @InjectHeaders
    Map<String, Object> headers;

You can also inject the Camel producer templates using @Producer annotation like in the ordinary Camel beans:

    @Produce(uri = "seda:queue:done")
    private ProducerTemplate doneQueue;

It is also possible to inject the CamelContext using the CamelContextAware interface:

   @FSM(start = InitialState.class)
   @Transitions
   public class TestStateMachine implements CamelContextAware {
       private CamelContext camelContext;

       @Override
       public void setCamelContext(CamelContext camelContext) {
           this.camelContext = camelContext;
       }

       @Override
       public CamelContext getCamelContext() {
           return camelContext;
       }
   }
ru.yandex.qatools

Camelot Framework

Simplified scalable aggregation and processing framework built upon Apache Camel.

Версии библиотеки

Версия
1.2
1.1
1.0