Hi

I'm trying to use Clojure with Apache MINA. I think Clojure it's the
ideal language to concurrently handle all the events that arrive into
MINA's separate threads.

So I tried to port the simplest example, the EchoServer (files here:
http://svn.apache.org/viewvc/mina/branches/1.0/example/src/main/java/org/apache/mina/example/echoserver/EchoProtocolHandler.java?view=log
and here:
http://svn.apache.org/viewvc/mina/branches/1.0/example/src/main/java/org/apache/mina/example/echoserver/Main.java?view=log)

This is what I wrote:

(import '(org.apache.mina.common ByteBuffer IdleStatus IoHandler
IoHandlerAdapter IoSession))
(import '(org.apache.mina.transport.socket.nio SocketAcceptor
SocketAcceptorConfig))
(import '(org.apache.mina.filter LoggingFilter))
(import '(java.net InetSocketAddress))

(def echo-handler
   (proxy [IoHandlerAdapter] []
      (sessionCreated [sess]
         (println (format "Session created: %s" sess)))

      (sessionIdle [sess status]
         (println (format "Session idle: %s" sess)))

      (messageReceived [sess message]
         (println (format "Received message: %s" message)))
   )
)

(def acceptor (SocketAcceptor.))

(def config (SocketAcceptorConfig.))

(.. config getFilterChain (addLast "log" (LoggingFilter.)))

(. acceptor bind (InetSocketAddress. 1234) echo-handler config)

(println "Listening in port 1234")



The server starts, but when I connect to it, it doesn't print
anything, so I'm guessing that I wrote the proxy wrong. It's supposed
to simply be a class that extends IoHandlerAdapter and overwrites the
sessionCreated, sessionIdle and messageReceived methods

any ideas?

thanks

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to