3
私は、最低限の外部依存関係(スプリングなどはありません)を埋め込んだmule 3を開始する予定です。それを行う方法のヒントは非常に高く評価されます。ありがとうございました。最低限の依存関係でMule 3を組み込むにはどうしたらいいですか?
私は、最低限の外部依存関係(スプリングなどはありません)を埋め込んだmule 3を開始する予定です。それを行う方法のヒントは非常に高く評価されます。ありがとうございました。最低限の依存関係でMule 3を組み込むにはどうしたらいいですか?
次の例では、インバウンドVMエンドポイントと文字列アペンダトランスフォーマーでフローを作成します。私はそれがあなたを始めなければならないと信じています。
MuleContext context = new DefaultMuleContextFactory().createMuleContext();
MuleRegistry registry = context.getRegistry();
EndpointBuilder testEndpointBuilder = new EndpointURIEndpointBuilder("vm://testFlow.in",
context);
testEndpointBuilder.setExchangePattern(MessageExchangePattern.REQUEST_RESPONSE);
registry.registerEndpointBuilder("testFlow.in", testEndpointBuilder);
InboundEndpoint vmInboundEndpoint = testEndpointBuilder.buildInboundEndpoint();
registry.registerEndpoint(vmInboundEndpoint);
StringAppendTransformer stringAppendTransformer = new StringAppendTransformer(" world");
stringAppendTransformer.setMuleContext(context);
Flow testFlow = new Flow("testFlow", context);
testFlow.setMessageSource(vmInboundEndpoint);
testFlow.setMessageProcessors(Arrays.asList((MessageProcessor) stringAppendTransformer));
registry.registerFlowConstruct(testFlow);
context.start();
MuleClient muleClient = new MuleClient(context);
MuleMessage response = muleClient.send("vm://testFlow.in", "hello", null);
Validate.isTrue(response.getPayloadAsString().equals("hello world"));
muleClient.dispose();
context.stop();
こんにちはデビッド、ありがとう。私はregistry.initialise()が必要だと思います。 after context.getRegistry() - それ以外の場合は、ラブがライフ・フェーズを欠いていると文句を言います。非常にうまくいきます!必要な依存関係は次のとおりです:commons-beanutils、commons-collections、commons-io、commons-lang、commons-logging、commons-pool、dom4j、geronimo-j2ee-connector、jaxen、jug - 悪くない。 – SorinS
奇妙なことに、コードは私のためにそのまま動作します(Mule 3.2.1)。 –
それは今でも私のために働く - それはそれを引き起こしたある時点で依存関係が欠落していたに違いない。再度、感謝します。 – SorinS