Components are responsible for creating their own threads.
Lifecycles methods should not be blocking.

Once you fill ok with your code, please raise a JIRA and attach a zip
with all the classes / test resources inside.

Cheers,
Guillaume Nodet

On 5/12/06, Doug Fischer <[EMAIL PROTECTED]> wrote:
Hopefully this time the attachment will go through.  I am not exactly sure
why it didn't before.  It is a zip file.

I guess I was thinking that when the component is deployed into the
lwcontainer that it would be running in its own thread anyway.  Apparently I
was incorrect in my assumption.

I am still trying to get a grasp on the whole ServiceMix thing so please
excuse my ignorance.

Thanks,
Doug


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

> I think the attachment have been lost.
>
> Btw, for a tcp consumer that creates a server socket, it has to wait
> for incoming connections, so how can you not start a thread ? The
> jabber api uses a listener, so it is really different.
>
> Cheers,
> Guillaume Nodet
>
> On 5/12/06, Doug Fischer <[EMAIL PROTECTED]> wrote:
>> I have attached my TcpComponentSupport class to this email.  If you could be
>> so kind to take a look at it and let me know if it looks ok.  You mentioned
>> that the start method should start a Thread and then kill that Thread in the
>> stop method.  I am not actually doing this right now however I of course
>> could implement it that way if necessary.  I attempted to use the
>> JabberComponentSupport class as a template.
>>
>> Please let me know your thoughts.
>>
>> Thanks,
>> Doug
>>
>>
>> On 5/12/06 8:06 AM, "Guillaume Nodet" <[EMAIL PROTECTED]> wrote:
>>
>>> 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