forked from apache/camel-quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9f56ec9
commit 18fe6f0
Showing
5 changed files
with
231 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...on-tests/jt400/src/main/java/org/apache/camel/quarkus/component/jt400/it/Jt400Routes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package org.apache.camel.quarkus.component.jt400.it; | ||
|
||
import com.ibm.as400.access.AS400Message; | ||
import jakarta.enterprise.context.ApplicationScoped; | ||
import org.apache.camel.builder.RouteBuilder; | ||
import org.apache.camel.component.jt400.Jt400Constants; | ||
import org.eclipse.microprofile.config.inject.ConfigProperty; | ||
|
||
@ApplicationScoped | ||
public class Jt400Routes extends RouteBuilder { | ||
|
||
@ConfigProperty(name = "cq.jt400.library") | ||
String jt400Library; | ||
|
||
@ConfigProperty(name = "cq.jt400.url") | ||
String jt400Url; | ||
|
||
@ConfigProperty(name = "cq.jt400.username") | ||
String jt400Username; | ||
|
||
@ConfigProperty(name = "cq.jt400.password") | ||
String jt400Password; | ||
|
||
@ConfigProperty(name = "cq.jt400.message-replyto-queue") | ||
String jt400MessageReplyToQueue; | ||
|
||
@Override | ||
public void configure() throws Exception { | ||
from(getUrlForLibrary(jt400MessageReplyToQueue + "?sendingReply=true")) | ||
.choice() | ||
.when(header(Jt400Constants.MESSAGE_TYPE).isEqualTo(AS400Message.INQUIRY)) | ||
.process((exchange) -> { | ||
String reply = "reply to: " + exchange.getIn().getBody(String.class); | ||
exchange.getIn().setBody(reply); | ||
}) | ||
.to(getUrlForLibrary(jt400MessageReplyToQueue)); | ||
} | ||
|
||
private String getUrlForLibrary(String suffix) { | ||
return String.format("jt400://%s:%s@%s%s", jt400Username, jt400Password, jt400Url, | ||
"/QSYS.LIB/" + jt400Library + ".LIB/" + suffix); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.