Hi 

I am a newbie in Akka and I implemented a TCP server which listens to 
device traffic. I have searched online and could not find any concrete 
examples of how to configure TLS using Akka IO.

I am not sure if I am missing the obvious.

I have asked this question earlier but without providing many details. This 
time, I have added more details hopefully will help to better understand my 
problem. (Hope this is not considered as spam :-) )


Background : What I am working on and where I am stuck, 

I have developed my POC using Akka IO  also, am using Akka v2.3.14 with 
Java 7. 

What I am trying to achieve is 
  - I should be able to configure new server ports with or without TLS 
  - Each TLS port should be able to point to a unique key store file for 
certificates



Actor creation path
----------------------------
Below is the paths of the some of the important Actors that are created 

The TCPProxyService class creates the ActorSystem and loads the port 
configurations and then creates the ProxyServiceActor. 
The ProxyServiceActor binds to the port (Code below). When the 
ProxyServiceActor receives a connection it creates the ProxyActor and 
ProxyActor intern creates ProxyListenerActor and ProxySenderActor and 
registers the ProxyListenerActor with the tcpManager (tcpManager = 
Tcp.get(getSystem().manger())


TCPProxyService ----> ProxyServiceActor(binds to the given server port) 
----> ProxyActor ----> ProxyListenerActor (registered TCP listener, listens 
on the client port ) 
                                                                            
                                                                     |
                                                                            
                                                                     |----> 
ProxySenderActor

Sample code 
-------------------                                                         
                                                 
The class defined below (ProxyServiceActor) is the class which binds to the 
port that it receives from the ProxyConfig instance which is configured 
using spring beans.xml

public class ProxyServiceActor extends UntypedActor {

        . . . .

@Override
public void preStart() throws Exception {
LOGGER.info("Listening on port = "  + proxyConfig.getPort());
tcpManager.tell(TcpMessage.bind(getSelf(), new 
InetSocketAddress(proxyConfig.getListenIP(), proxyConfig.getPort()), 
backlog), getSelf());
}

public void onReceive(Object msg) throws Exception {
if (msg instanceof Connected) {
. . . . 

ActorRef proxy = 
getContext().actorOf(Props.create(ProxyActor.class),ActorConstants.PATH_PROXY+counter);
. . . .

proxy.tell(new Object[]{getSender(), msg}, getSelf())
}

}
        . . . .
}


For each new connection, a ProxyActor instance is created and the 
ProxyActor creates a ProxyListenerActor instance and registers the 
ProxyListenerActor to listen for messages from the 
newly connected client. (Sample code below)

public class ProxyActor extends UntypedActor {

. . . 

public void onReceive(Object msg) throws Exception {
if (msg instanceof Object[]) {
. . . .
ActorRef proxyListener = 
getContext().actorOf(Props.create(ProxyListenerActor.class, 
msg[1]),ActorConstants.PATH_PROXY_LISTENER+device.getCounter());
. . . . 

msg[0].tell(TcpMessage.register(proxyListener), getSelf());

. . . .
}
}
. . . .
}

The ProxyListenerActor is the class that listens on the port for messages 
from the client. All outbound communication is done using the 
ProxySenderActor


Thanks & Regards
Vinay


-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to