Your code seems fine.  I doubt the call to getText() really takes a lot of time.
Also, did you made sure to not run with a log level at DEBUG ?
It would change performances a lot and would even change the kind of
Source used in the exchanges.

On Wed, Sep 17, 2008 at 7:29 AM, sachin2008 <[EMAIL PROTECTED]> wrote:
>
> Hi,
> I have changed the statement
> new  SourceTransformer().contentToString()  as follows:
>
> String inMessageXml = in.getContent() instanceof StringSource ?
> ((StringSource) in.getContent()).getText() :
> sourceTransformer.contentToString(in);
>
> SourceTransformer will be invoked only if the Source is not of type
> StringSource.
> But, Even if the contents of In message is a StringSource it is taking some
> amount of time(0 - 30 ms).
>
> How can we enchance this step? This is very imortant because we are using
> this step many times in our application and overall itcounts to around 100
> ms.
>
> Thanks
>
>
>
> gnodet wrote:
>>
>> The reason may not be in the StringSource, but rather in the
>> SourceTransformer that does not recognize StringSource and process
>> those as StreamSource instead, thus doing an xml transformation to
>> convert the stream source to a string source.  I guess this could be
>> easily enhanced though.
>>
>> On Mon, Sep 15, 2008 at 6:01 AM, sachin2008 <[EMAIL PROTECTED]> wrote:
>>>
>>> Thanks gnodet for your help.
>>>
>>> I  have some doubt regarding the StringSource. In, A bean component i am
>>> creating a new stringsource object by passing a string as parameter. And
>>> i
>>> am setting this stringsource as contents of NM.
>>>
>>> When i tried to retrieve the cotnents of NM using the statemet new
>>> SourceTransformer().contentToString() in another bean component i
>>> observed
>>> that it is taking some amount of time i;e 5 milli seconds. And this is
>>> very
>>> inconsistent. Some times it is taking 0 ms and some times it is taking 5
>>> ms.
>>> What could be the reason for this.
>>>
>>>
>>>
>>>
>>> gnodet wrote:
>>>>
>>>> The NMR itself does not know about the kind of source you use.
>>>> If you turn off debug logging and do not use the JMS/JCA flow, no
>>>> processing should be done on the exchanges (no transformation), so
>>>> passing a StreamSource or a StringSource won't change anything.  The
>>>> changes could happen on the components side but i don't think there
>>>> would be much difference.
>>>> When sending an exchange into the NMR (and if you don't use JMS/JCA
>>>> flow), the exact same object will be given to the target component (no
>>>> serialization happen).
>>>>
>>>> On Fri, Sep 12, 2008 at 5:54 PM, sachin2008 <[EMAIL PROTECTED]>
>>>> wrote:
>>>>>
>>>>> Hi ,
>>>>>
>>>>> We are using Stringsource in our servicemix application instead of
>>>>> streamsource to get rid of stream readout problems.
>>>>>
>>>>> If, we use Source as Stringsource in the NormalizedMessage  and send to
>>>>> any
>>>>> other service with in the same ESB, does the referrence alone will be
>>>>> passed
>>>>> in the NormalizedMessage(NM) or the entire string  gets serialized  and
>>>>> the
>>>>> string contents will also be transfer along  with the NM.
>>>>>
>>>>> If, I  set  a string of size around 500 KB as StringSource in the NM
>>>>> and
>>>>> if
>>>>> i send  the NM to other service i observed some delay in the  message
>>>>> transmission.
>>>>>
>>>>> Does this way of exchanging StringSourced NMs is same as that of
>>>>> exchanging
>>>>> objects with referrences or it's  a different.
>>>>>
>>>>> Please clear this doubt as it is very important for us.
>>>>>
>>>>> Regards
>>>>>
>>>>>
>>>>> -----
>>>>> Cheers
>>>>> Praveen Oruganti
>>>>> "Think before you act and act on what you believe"
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/String-source-performance-tp19458268p19458268.html
>>>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Cheers,
>>>> Guillaume Nodet
>>>> ------------------------
>>>> Blog: http://gnodet.blogspot.com/
>>>>
>>>>
>>>
>>>
>>> -----
>>> Cheers
>>> Praveen Oruganti
>>> "Think before you act and act on what you believe"
>>> --
>>> View this message in context:
>>> http://www.nabble.com/String-source-performance-tp19458268p19486983.html
>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Cheers,
>> Guillaume Nodet
>> ------------------------
>> Blog: http://gnodet.blogspot.com/
>>
>>
>
>
> -----
> Cheers
> Praveen Oruganti
> "Think before you act and act on what you believe"
> --
> View this message in context: 
> http://www.nabble.com/String-source-performance-tp19458268p19525629.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/

Reply via email to