2

@Configuration次のxmlがあり、この迷惑なxmlをクラスに置き換えたい

<int:gateway id="someActionGateway "
        service-interface="x.y.z.SomeActionGateway"
        default-request-channel="some-action-channel-raw" />

 <int:channel id="some-action-channel-raw" />

 <int:header-enricher input-channel="some-action-channel-raw" output-channel="some-action-to-json-channel">
        <int:header name="someAction" value="sendSomething"/>
 </int:header-enricher>

    <int:channel id="some-action-to-json-channel" />

    <int:object-to-json-transformer
        input-channel="some-action-to-json-channel" output-channel="some-action-outbound-channel"
        content-type="text/x-json" />

    <int:channel id="some-action-outbound-channel" />

    <int-amqp:outbound-channel-adapter
        channel="some-action-outbound-channel" exchange-name="some-action-exchange"
        routing-key="someAction.routing.key" amqp-template="amqpTemplate"
        mapped-request-headers="*">
    </int-amqp:outbound-channel-adapter>

    <rabbit:direct-exchange name="some-action-exchange"
        auto-delete="false" durable="true">
        <rabbit:bindings>
            <rabbit:binding queue="some-action-queue" key="someAction.routing.key" />
        </rabbit:bindings>
    </rabbit:direct-exchange>

そして私のゲートウェイ:

public interface SomeActionGateway {

    @Gateway
    public void sendSomething(@Payload SomeDto dto);

}

spring-amqp の構成アノテーション付きクラスを既に使用していますが、正常に動作します。Spring Integration 構成で同じことを行うにはどうすればよいですか?

PS: Spring 3.2 と Spring Integration 3.0 を使用しています。

4

1 に答える 1

4

XML 構成が「煩わしい」と感じて申し訳ありません。

@ConfigurationSpring Integrationの JavaConfig ( ) エクスペリエンスの改善に取り組んでいます。

現在、JavaConfig を使用して任意のエンドポイントを接続できますが、きれいではありません。MessageDrivenConsumerエンドポイントは、 (またはPollingConsumer) と適切な を組み合わせて配線できますMessageHandlerConsumerEndpointFactoryBean完全な詳細については、 および XML パーサーを掘り下げる必要があります。ほとんどのコンポーネントには、複数の Bean 定義が必要です。

私が言ったように、私たちはそれに取り組んでいます。現在、ゲートウェイのオープンプル リクエストがあり、拡張リポジトリで進行中の Java DSLがありますが、Scala および Groovy DSL と同様に進行中です。

編集:

Spring Integration 4.0 では、はるかに使いやすくなっています@Configuration

最近のウェビナーをご覧ください。

于 2014-02-19T01:32:39.860 に答える