[ 
https://issues.apache.org/activemq/browse/CAMEL-1077?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=54829#action_54829
 ] 

Barry Kaplan commented on CAMEL-1077:
-------------------------------------

Actually, I implemented this yesterday just after I posted the comment. It was 
really quite simple. Here's what I did:

- created an interface MinaService 
- from MinaConsumer extracted MinaAcceptor extends MinaService, leaving an 
instance of MinaService
- from MinaProducer extracted MinaConnector extends MinaService, leaving an 
instance of MinaService
- Added the 'service={acceptor|connector}' property to MinaConfiguration along 
with a factory method to create a concrete MinaService (used by 
MinaConsumer/Producer).

All tests are green, but I have not yet added tests for the case where consumer 
is the connector and visa versa. But this is how my application works (as well 
as many FIX engines) and I am doing some smoke testing. The problem I am 
hitting is how to formulate a route in which the the producer/acceptor binds. 
(I'll probably figure it out, but any advice would be appreciated.)

Since I need a Ping in my application I will setup a route on the producer side 
like: from("mina:...&service=acceptor").to("direct:ping). 

But really a more general solution is needed. If I can get to this work I'll 
add tests within camel-mina and submit a patch.

> tcp client mode / server mode determined by "to" or "from" elements limits 
> usability.
> -------------------------------------------------------------------------------------
>
>                 Key: CAMEL-1077
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1077
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-mina
>    Affects Versions: 1.0.0, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.5.0
>            Reporter: Jeff Vienneau
>
> Internally, 
> MinaProducer is coded to create a Mina connector (client mode socket).
> MinaConsumer is coded to create a Mina acceptor (server mode socket).
> Additionally, it appears a producer (client mode socket) is created for a 
> "to" route mapping and a consumer (server mode socket) is created for a 
> "from" route mapping.
> This means an endpoint cannot be created in which the session is initiated by 
> a client and messages are routed "to" the client. 
> The opposite is also true, an endpoint with a "from" route mapping cannot 
> establish a connection to a tcp server.
> This is a major limitation, as we do not often have control over the systems 
> with which we are interfacing.
> Perhaps, the mina::tcp URI could have a parameter the sets the socket mode: 
> tcp.mode=server or tcp.mode=client.
> Hope this make sense, thanks!

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to