Not sure to understand the problem.
Usually a lightweight consumer BC will begin to receive messages when
the component is started.  It means that all the necessary
configuration parameters have been set.
The tcp component needs to start a thread inside the start method (and
kill it inside the stop method).

The second problem is related to components / service units lifecycle.
When a lightweight component is deployed to the lwcontainer, he has a
specific lifecycle: when the service unit is started, the component is
started and when the service unit is stopped, the component is
shutdown.

But the problem should only occur when someone sends something on the socket ...

Cheers,
Guillaume Nodet

On 5/12/06, Doug Fischer <[EMAIL PROTECTED]> wrote:
Guillaume,

Yes you are right, I did ask before (somehow I got sidetracked an forgot all
about it).  Anyway, thank you for the reply though.

I have been able to implement a TcpComponentSupport class, at least I think
so anyway.  The problem that I am having now is that as soon as I deploy the
component it starts collecting data and pushing it to the bus.  I have run
into a couple of problems because of this.  The first problem is while
testing, I would like to extend from TestSupport and use the
assertMessagesReceived(), however when it loads the ApplicationContext, the
concrete TcpComponentSupport class simply begins communicating over the
socket and the test method with the assertMessagesReceived() call is never
executed.  The test will just run forever.

The second question that I have is along the same lines.  I would like to
create a service unit, with simply this component in it and deploy it to
ServiceMix and then use something like eip to route the messages where I
want them.  The same kind of problem occurs in this scenario, as soon as the
service unit is deployed, it will start collecting data from the stream and
trying to push it to the bus, the problem is that there is no destination
assigned to the the component yet so it tries to send it to "service: null
and interface null".

Do you have any ideas?

Thank you,
Doug


On 5/11/06 3:19 AM, "Guillaume Nodet" <[EMAIL PROTECTED]> wrote:

> It seems there's none -- if I recall, you have already asked this question ;)
> However, it should not be very difficult to implement.
> You have to inherit the
> org.apache.servicemix.components.util.ComponentSupport and implements
> MessageExchangeListener.  Then, just create your socket and read it :)
> You may need another lw component for sending over tcp, also.
>
> Cheers,
> Guillaume Nodet
>
> On 5/10/06, Doug Fischer <[EMAIL PROTECTED]> wrote:
>> Does anyone know if a basic TCP component is available?  What I would like
>> to be able to do is simply extend from a TCP component, set the host and
>> port in the servicemix.xml file, and have access to the input and output
>> streams in my implementation class.  I would then want to be able to read
>> from the input stream and create a NormalizedMessage to put on the bus and
>> also be able to get a message from the bus and write it to the output
>> stream.
>>
>> Is there anything like this out there?
>>
>> Thanks,
>> Doug
>>
>>
>



Reply via email to