I am new with Apache Camel and I am trying to create a simple proxy that redirect all messages from localhost:3260 to localhost:3261 using Apache Mina. I am basing on some examples at internet (https://www.youtube.com/watch?v=jZE-YSHK_gw&sns=tw) and changing for what is my propose. In this example is a redirect of a file and I just changed to use mina protocol.
import org.apache.camel.CamelContext;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.simple.MyRouteBuilder;
public class MainTcpApp {
public static void main(String[] args) throws Exception {
MyRouteBuilder routeBuilder = new MyRouteBuilder();
CamelContext context = new DefaultCamelContext();
try {
context.addRoutes(routeBuilder);
context.start();
for (;;) {
Thread.sleep(5 * 60 * 50000);
}
} catch (Exception e) {
System.err.println(e.getMessage());
} finally {
context.stop();
}
}
}
import org.apache.camel.builder.RouteBuilder;
public class MyTcpRouteBuilder extends RouteBuilder {
public void configure() throws Exception {
from("mina:tcp://localhost:3260").to("mina:tcp://localhost:3261");
}
}
In my example I started a target iSCSI at 3261 "target name: iqn.2014-06.iscsi-dev:disk1 loaded. Address: 127.0.0.1 - port: 3261" and I am trying to connect through 3260.
iscsiadm -m node --login -T iqn.2014-06.ustore-dev:disk1 -p 127.0.0.1:3260
Logging in to [iface: default, target: iqn.2014-06.ustore-dev:disk1, portal: 127.0.0.1,3260] (multiple)
iscsiadm: Could not login to [iface: default, target: iqn.2014-06.ustore-dev:disk1, portal: 127.0.0.1,3260].
iscsiadm: initiator reported error (8 - connection timed out)
iscsiadm: Could not log into all portals
I already could do it with http://netty.io/, but as I want a load balance I will need Apache Camel with Mina. Thanks.