Skip to content

Instantly share code, notes, and snippets.

@swt02026
Last active June 25, 2021 00:10
Show Gist options
  • Save swt02026/f6bf729c886555b158b1903bbbb40b61 to your computer and use it in GitHub Desktop.
Save swt02026/f6bf729c886555b158b1903bbbb40b61 to your computer and use it in GitHub Desktop.
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