Last active
June 25, 2021 00:10
-
-
Save swt02026/f6bf729c886555b158b1903bbbb40b61 to your computer and use it in GitHub Desktop.
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
import org.apache.camel.builder.RouteBuilder | |
import org.apache.camel.impl.DefaultCamelContext | |
import org.apache.camel.main.Main | |
import java.text.SimpleDateFormat | |
import java.util.* | |
fun getCurrentDate():String{ | |
val sdf = SimpleDateFormat("yyyyMMdd") | |
return sdf.format(Date()) | |
} | |
class SendToDataQueueRouteBuilder: RouteBuilder() | |
{ | |
override fun configure() { | |
from("netty:tcp://0.0.0.0:1234") | |
//.to("file:D:logs.txt") | |
.to("jt400://XXX:XX@XXXX/QSYS.LIB/XXX.LIB/XXX.DTAQ") | |
} | |
} | |
class ReceiveFromDataQueueRouteBuilder: RouteBuilder() | |
{ | |
override fun configure() { | |
from("jt400://XXX:XXX@XXXX/QSYS.LIB/XXX.LIB/XXX.DTAQ") | |
.to("netty:tcp://0.0.0.0:1235") | |
//.to("stream:out") | |
} | |
} | |
fun main() { | |
val main = Main() | |
val ctx = DefaultCamelContext() | |
ctx.addRoutes(SendToDataQueueRouteBuilder()) | |
ctx.addRoutes(ReceiveFromDataQueueRouteBuilder()) | |
ctx.start() | |
main.run() | |
ctx.stop() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment