Regarding SECAs

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Regarding SECAs

Varun Bhansaly
Hi,
I am using ofbiz 09.04, wanted to know if its possible to configure a seca
on a service which could be invoked multiple times with different values -
The scenario -

<eca service="someService" event="invoke">
        <set field-name="field1" value="SOME_VALUE1"/>
        <action service="serviceToBeInvoked" mode="sync"/>
</eca>
<eca service="someService" event="invoke">
        <set field-name="field1" value="SOME_VALUE2"/>
        <action service="serviceToBeInvoked" mode="sync"/>
</eca>
<eca service="someService" event="invoke">
        <set field-name="field1" value="SOME_VALUE3"/>
        <action service="serviceToBeInvoked" mode="sync"/>
</eca>

So for every someService invoke, serviceToBeInvoked should be executed 3
times with different values for field1.
With the above configuration, service engine executes serviceToBeInvoked
only once.
What could be other suggested ways so that serviceToBeInvoked is executed 3
times.

--
Regards,
Varun Bhansaly
Reply | Threaded
Open this post in threaded view
|

Re: Regarding SECAs

Michał Cukierman-2
I am an ofbiz newbe. Could you write a service wrapper in simple method?
For example:

<service name="yourServiceWrapper" engine="simple" auth="true"
                location="component://your/component/YourServices.xml"
invoke="yourMethod">
    </service>

and:

<eca service="someService" event="invoke">
        <action service="yourServiceWrapper" mode="sync"/>

and in a simple method pass your aguments and invoke someService, lets
say in a loop?
I suppose you set arguments in your service declaration as well.


Dnia 2010-09-09, czw o godzinie 07:25 +0530, varun bhansaly pisze:

> Hi,
> I am using ofbiz 09.04, wanted to know if its possible to configure a seca
> on a service which could be invoked multiple times with different values -
> The scenario -
>
> <eca service="someService" event="invoke">
>         <set field-name="field1" value="SOME_VALUE1"/>
>         <action service="serviceToBeInvoked" mode="sync"/>
> </eca>
> <eca service="someService" event="invoke">
>         <set field-name="field1" value="SOME_VALUE2"/>
>         <action service="serviceToBeInvoked" mode="sync"/>
> </eca>
> <eca service="someService" event="invoke">
>         <set field-name="field1" value="SOME_VALUE3"/>
>         <action service="serviceToBeInvoked" mode="sync"/>
> </eca>
>
> So for every someService invoke, serviceToBeInvoked should be executed 3
> times with different values for field1.
> With the above configuration, service engine executes serviceToBeInvoked
> only once.
> What could be other suggested ways so that serviceToBeInvoked is executed 3
> times.
>

Reply | Threaded
Open this post in threaded view
|

Re: Regarding SECAs

Varun Bhansaly
What I have implemented is, create 3 services serviceToBeInvoked1,
serviceToBeInvoked2, serviceToBeInvoked3.
Service definition for these 3 would point to serviceToBeInvoked, so it will
be like this.

<service name="serviceToBeInvoked1" engine="simple" auth="true"
location="component://your/component/YourServices.xml"
invoke="serviceToBeInvoked">
etc.

2010/9/9 Michał Cukierman <[hidden email]>

> I am an ofbiz newbe. Could you write a service wrapper in simple method?
> For example:
>
> <service name="yourServiceWrapper" engine="simple" auth="true"
>                location="component://your/component/YourServices.xml"
> invoke="yourMethod">
>    </service>
>
> and:
>
> <eca service="someService" event="invoke">
>         <action service="yourServiceWrapper" mode="sync"/>
>
> and in a simple method pass your aguments and invoke someService, lets
> say in a loop?
> I suppose you set arguments in your service declaration as well.
>
>
> Dnia 2010-09-09, czw o godzinie 07:25 +0530, varun bhansaly pisze:
> > Hi,
> > I am using ofbiz 09.04, wanted to know if its possible to configure a
> seca
> > on a service which could be invoked multiple times with different values
> -
> > The scenario -
> >
> > <eca service="someService" event="invoke">
> >         <set field-name="field1" value="SOME_VALUE1"/>
> >         <action service="serviceToBeInvoked" mode="sync"/>
> > </eca>
> > <eca service="someService" event="invoke">
> >         <set field-name="field1" value="SOME_VALUE2"/>
> >         <action service="serviceToBeInvoked" mode="sync"/>
> > </eca>
> > <eca service="someService" event="invoke">
> >         <set field-name="field1" value="SOME_VALUE3"/>
> >         <action service="serviceToBeInvoked" mode="sync"/>
> > </eca>
> >
> > So for every someService invoke, serviceToBeInvoked should be executed 3
> > times with different values for field1.
> > With the above configuration, service engine executes serviceToBeInvoked
> > only once.
> > What could be other suggested ways so that serviceToBeInvoked is executed
> 3
> > times.
> >
>
>


--
Regards,
Varun Bhansaly
Reply | Threaded
Open this post in threaded view
|

Re: Regarding SECAs

Deepak Dixit-2
Hi Varun,

You call same service in seca for different parameter. You can take
reference for accounting/servicedef/secas.xml, here is the example :

    <eca service="createCreditCard" event="commit">
        <set field-name="mode" value="CREATE"/>
        <action service="verifyCreditCard" mode="sync"
run-as-user="system"/>
    </eca>
    <eca service="updateCreditCard" event="commit">
        <condition-field field-name="oldPaymentMethodId"
operator="not-equals" to-field-name="paymentMethodId"/>
        <set field-name="mode" value="UPDATE"/>
        <action service="verifyCreditCard" mode="sync"
run-as-user="system"/>
    </eca>


Thanks & Regards
--
Deepak Dixit
HotWax Media Pvt. Ltd.
Website :- www.hotwaxmedia.com
Contact :- +91-98267-54548
Skype Id :- deepakdixit




varun bhansaly wrote:

> What I have implemented is, create 3 services serviceToBeInvoked1,
> serviceToBeInvoked2, serviceToBeInvoked3.
> Service definition for these 3 would point to serviceToBeInvoked, so it will
> be like this.
>
> <service name="serviceToBeInvoked1" engine="simple" auth="true"
> location="component://your/component/YourServices.xml"
> invoke="serviceToBeInvoked">
> etc.
>
> 2010/9/9 Michał Cukierman <[hidden email]>
>
>  
>> I am an ofbiz newbe. Could you write a service wrapper in simple method?
>> For example:
>>
>> <service name="yourServiceWrapper" engine="simple" auth="true"
>>                location="component://your/component/YourServices.xml"
>> invoke="yourMethod">
>>    </service>
>>
>> and:
>>
>> <eca service="someService" event="invoke">
>>         <action service="yourServiceWrapper" mode="sync"/>
>>
>> and in a simple method pass your aguments and invoke someService, lets
>> say in a loop?
>> I suppose you set arguments in your service declaration as well.
>>
>>
>> Dnia 2010-09-09, czw o godzinie 07:25 +0530, varun bhansaly pisze:
>>    
>>> Hi,
>>> I am using ofbiz 09.04, wanted to know if its possible to configure a
>>>      
>> seca
>>    
>>> on a service which could be invoked multiple times with different values
>>>      
>> -
>>    
>>> The scenario -
>>>
>>> <eca service="someService" event="invoke">
>>>         <set field-name="field1" value="SOME_VALUE1"/>
>>>         <action service="serviceToBeInvoked" mode="sync"/>
>>> </eca>
>>> <eca service="someService" event="invoke">
>>>         <set field-name="field1" value="SOME_VALUE2"/>
>>>         <action service="serviceToBeInvoked" mode="sync"/>
>>> </eca>
>>> <eca service="someService" event="invoke">
>>>         <set field-name="field1" value="SOME_VALUE3"/>
>>>         <action service="serviceToBeInvoked" mode="sync"/>
>>> </eca>
>>>
>>> So for every someService invoke, serviceToBeInvoked should be executed 3
>>> times with different values for field1.
>>> With the above configuration, service engine executes serviceToBeInvoked
>>> only once.
>>> What could be other suggested ways so that serviceToBeInvoked is executed
>>>      
>> 3
>>    
>>> times.
>>>
>>>      
>>    
>
>
>  


Reply | Threaded
Open this post in threaded view
|

Re: Regarding SECAs

Varun Bhansaly
Thanks Deepak,
For the current scenario, parameters & event have to be same.
A good example (similar to mine is) is secas on storeOrder.

On Thu, Sep 9, 2010 at 4:50 PM, Deepak Dixit
<[hidden email]>wrote:

> Hi Varun,
>
> You call same service in seca for different parameter. You can take
> reference for accounting/servicedef/secas.xml, here is the example :
>
>   <eca service="createCreditCard" event="commit">
>       <set field-name="mode" value="CREATE"/>
>       <action service="verifyCreditCard" mode="sync" run-as-user="system"/>
>   </eca>
>   <eca service="updateCreditCard" event="commit">
>       <condition-field field-name="oldPaymentMethodId"
> operator="not-equals" to-field-name="paymentMethodId"/>
>       <set field-name="mode" value="UPDATE"/>
>       <action service="verifyCreditCard" mode="sync" run-as-user="system"/>
>   </eca>
>
>
> Thanks & Regards
> --
> Deepak Dixit
> HotWax Media Pvt. Ltd.
> Website :- www.hotwaxmedia.com
> Contact :- +91-98267-54548
> Skype Id :- deepakdixit
>
>
>
>
>
> varun bhansaly wrote:
>
>> What I have implemented is, create 3 services serviceToBeInvoked1,
>> serviceToBeInvoked2, serviceToBeInvoked3.
>> Service definition for these 3 would point to serviceToBeInvoked, so it
>> will
>> be like this.
>>
>> <service name="serviceToBeInvoked1" engine="simple" auth="true"
>> location="component://your/component/YourServices.xml"
>> invoke="serviceToBeInvoked">
>> etc.
>>
>> 2010/9/9 Michał Cukierman <[hidden email]>
>>
>>
>>
>>> I am an ofbiz newbe. Could you write a service wrapper in simple method?
>>> For example:
>>>
>>> <service name="yourServiceWrapper" engine="simple" auth="true"
>>>               location="component://your/component/YourServices.xml"
>>> invoke="yourMethod">
>>>   </service>
>>>
>>> and:
>>>
>>> <eca service="someService" event="invoke">
>>>        <action service="yourServiceWrapper" mode="sync"/>
>>>
>>> and in a simple method pass your aguments and invoke someService, lets
>>> say in a loop?
>>> I suppose you set arguments in your service declaration as well.
>>>
>>>
>>> Dnia 2010-09-09, czw o godzinie 07:25 +0530, varun bhansaly pisze:
>>>
>>>
>>>> Hi,
>>>> I am using ofbiz 09.04, wanted to know if its possible to configure a
>>>>
>>>>
>>> seca
>>>
>>>
>>>> on a service which could be invoked multiple times with different values
>>>>
>>>>
>>> -
>>>
>>>
>>>> The scenario -
>>>>
>>>> <eca service="someService" event="invoke">
>>>>        <set field-name="field1" value="SOME_VALUE1"/>
>>>>        <action service="serviceToBeInvoked" mode="sync"/>
>>>> </eca>
>>>> <eca service="someService" event="invoke">
>>>>        <set field-name="field1" value="SOME_VALUE2"/>
>>>>        <action service="serviceToBeInvoked" mode="sync"/>
>>>> </eca>
>>>> <eca service="someService" event="invoke">
>>>>        <set field-name="field1" value="SOME_VALUE3"/>
>>>>        <action service="serviceToBeInvoked" mode="sync"/>
>>>> </eca>
>>>>
>>>> So for every someService invoke, serviceToBeInvoked should be executed 3
>>>> times with different values for field1.
>>>> With the above configuration, service engine executes serviceToBeInvoked
>>>> only once.
>>>> What could be other suggested ways so that serviceToBeInvoked is
>>>> executed
>>>>
>>>>
>>> 3
>>>
>>>
>>>> times.
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>>
>>
>
>
>


--
Regards,
Varun Bhansaly