Fuse 6 is no longer supportedAs of February 2025, Red Hat Fuse 6 is no longer supported. If you are using Fuse 6, please upgrade to Red Hat build of Apache Camel.
Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
14.2. Use a RemoteInvoker
Procedure 14.1. Task
Include a RemoteInvoker and supporting classes in your application with the following Maven dependency:
<dependency>
<groupId>org.switchyard</groupId>
<artifactId>switchyard-remote</artifactId>
<version> <!-- SY version goes here (e.g. 1.0) --> </version>
</dependency>
<dependency>
<groupId>org.switchyard</groupId>
<artifactId>switchyard-remote</artifactId>
<version> <!-- SY version goes here (e.g. 1.0) --> </version>
</dependency>
Copy to ClipboardCopied!Toggle word wrapToggle overflow
Each instance of SwitchYard includes a special context path called switchyard-remote, which is bound to the default HTTP listener in Red Hat JBoss Fuse. The initial version of RemoteInvoker supports communication with this endpoint directly. Here is an example of invoking an in-out service in SwitchYard using the HttpInvoker:
public class MyClient {
public static void main(String[] args) throws Exception {
RemoteInvoker invoker = new HttpInvoker("http://localhost:8080/switchyard-remote");
Offer offer = new Offer();
offer.setAmount(100);
offer.setItem("honda");
RemoteMessage msg = invoker.invoke(new RemoteMessage()
.setContext(new DefaultContext())
.setService(new QName("urn:com.example.switchyard:remote", "Dealer"))
.setContent(offer));
Deal deal = (Deal)msg.getContent();
System.out.println("It's a deal? " + deal.isAccepted());
}
}
public class MyClient {
public static void main(String[] args) throws Exception {
RemoteInvoker invoker = new HttpInvoker("http://localhost:8080/switchyard-remote");
Offer offer = new Offer();
offer.setAmount(100);
offer.setItem("honda");
RemoteMessage msg = invoker.invoke(new RemoteMessage()
.setContext(new DefaultContext())
.setService(new QName("urn:com.example.switchyard:remote", "Dealer"))
.setContent(offer));
Deal deal = (Deal)msg.getContent();
System.out.println("It's a deal? " + deal.isAccepted());
}
}
Copy to ClipboardCopied!Toggle word wrapToggle overflow
Wir helfen Red Hat Benutzern, mit unseren Produkten und Diensten innovativ zu sein und ihre Ziele zu erreichen – mit Inhalten, denen sie vertrauen können. Entdecken Sie unsere neuesten Updates.
Mehr Inklusion in Open Source
Red Hat hat sich verpflichtet, problematische Sprache in unserem Code, unserer Dokumentation und unseren Web-Eigenschaften zu ersetzen. Weitere Einzelheiten finden Sie in Red Hat Blog.
Über Red Hat
Wir liefern gehärtete Lösungen, die es Unternehmen leichter machen, plattform- und umgebungsübergreifend zu arbeiten, vom zentralen Rechenzentrum bis zum Netzwerkrand.