On Sun, Jun 13, 2010 at 9:57 PM, M.Ismail <[email protected]> wrote:
>
> Thanks for reply. I am now trying to create a singleton bean in the route
> that stores the login state for all of the messages (and not just through
> one message's flow).
>
> in camel-context I created this bean:
>
> <bean id="LoginBean" class="myPackage.LoginStateBean" scope="singleton">
>                <property name="logOut" value="true"/>
>        </bean>
>
> and in my route:
> .when().method( mypackage.LoginStateBean.class, "isLogOut")// We are going
> to attempt to login
>

This route must invoke the bean with id LoginBean. So you gotta do
something like
.method("LoginBean", "isLogOut")


> the only problem is that it doesn't store (cache) its state. May be because
> there is no way to put the option "cache=true". I thought that by making
> scope="singleton" it will be enough. But apparently it isn't. All I want to
> do is make this bean a singleton so that it will store its state. Any
> suggestions?
>
> Thanks,
>
>
> Claus Ibsen-2 wrote:
>>
>> On Sat, Jun 12, 2010 at 4:38 PM, M.Ismail <[email protected]> wrote:
>>>
>>> Hi All,
>>>
>>> I'm working on an integration with a TCP server and I want to save my
>>> login
>>> state (Logged/Not logged) in some variable or in the registry. For
>>> example,
>>> whenever I receive a message I may either login if I didn't do that
>>> before
>>> and then send the original message or I could simply forward the message
>>> to
>>> the server if I'm already logged in. I tried exchange.setProperty() but
>>> it
>>> can only store properties along a single flow i.e. after the message is
>>> sent
>>> to its destination and another one is received the property is gone!
>>>
>>> I'm using camel 2.3 and running it inside the spring container which is
>>> also
>>> my registry (is it read only? if not could someone tell me how to add to
>>> it
>>> in the runtime?).
>>>
>>> What do you suggest?
>>>
>>
>> A bit like the Claim Check EIP pattern
>> http://camel.apache.org/claim-check.html
>>
>> But in your case just create a bean which you use to store/retrieve
>> the login state.
>> Then add that as a spring bean and you can access this bean in the Camel
>> routes.
>>
>>
>>
>>> Thanks
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Saving-Login-state-in-the-route-tp28865247p28865247.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
> --
> View this message in context: 
> http://old.nabble.com/Saving-Login-state-in-the-route-tp28865247p28873555.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Reply via email to