So it could introduce an annotation or use the @Resource just like
@SagaStart
public void booking(@Resource OmegaContext context) {
...
}

and we also can inject the OmegaContext during invoking the method.

Zhang Lei <coolbee...@gmail.com> 于2019年11月13日周三 下午11:42写道:

> Hi, Zheng Feng
>
> Both are ok.
>
> I saw in [1] that the TransactionContext is passed using parameters. I just
> recommend passing some parameters in a consistent way.
>
> [1]
>
> https://issues.apache.org/jira/browse/SCB-785?focusedCommentId=16561332&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-16561332
>
> Best regards,
> Lei Zhang
>
> On November 13, 2019 at 9:45:58 PM, Zheng Feng (zh.f...@gmail.com) wrote:
>
> I'm not very clear what could be benefited from these changes ? with
> declaring the OmegaContext explicitly ?
>
> Willem Jiang <willem.ji...@gmail.com> 于2019年11月13日周三 下午3:47写道:
>
> > If it is optional, we need to inject the OmegaContext dynamically and
> > provide a wrap method for it.
> >
> > Willem Jiang
> >
> > Twitter: willemjiang
> > Weibo: 姜宁willem
> >
> > On Wed, Nov 13, 2019 at 3:42 PM Zhang Lei <coolbee...@gmail.com> wrote:
> > >
> > > Hi, Willem Jiang
> > >
> > > I think OmegaContext is an optional parameter in the method
> > >
> > >
> > > Best regards,
> > > Lei Zhang
> > >
> > > On November 13, 2019 at 2:48:08 PM, Willem Jiang (
> willem.ji...@gmail.com
> > )
> > > wrote:
> > >
> > > Just a quick question, if user call the booking() method, he need to
> > > pass the OmegaContext as a parameter.
> > > What if the invoker doesn't know anything about the OmegaContext.
> > >
> > >
> > > Willem Jiang
> > >
> > > Twitter: willemjiang
> > > Weibo: 姜宁willem
> > >
> > > On Tue, Nov 12, 2019 at 11:34 PM Zhang Lei <coolbee...@gmail.com>
> wrote:
> > > >
> > > > Hi, Pack Team
> > > >
> > > > Currently, the @Autowired annotation is required to get the
> > OmegaContext
> > > on
> > > > the Omega side, but most of the early use does not know the existence
> > of
> > > > the OmegaContext object.
> > > >
> > > > @Autowired
> > > > OmegaContext omegaContext;
> > > >
> > > > @SagaStart
> > > > public void booking() {
> > > > omegaContext.globalTxId()
> > > > ...
> > > > }
> > > >
> > > > @Compensable(compensationMethod="cancel")
> > > > public void car(String from, int amount) {
> > > > omegaContext.globalTxId()
> > > > ...
> > > > }
> > > >
> > > >
> > > > Maybe we should allow the user to get the OmegaContext via method
> > > > parameters. Use the method below to define the OmegaContext
> parameter.
> > > >
> > > > @SagaStart
> > > > public void booking(OmegaContext omegaContext) {
> > > > omegaContext.globalTxId()
> > > > ...
> > > > }
> > > >
> > > > @Compensable(compensationMethod="cancel")
> > > > public void car(OmegaContext omegaContext, String from, int amount) {
> > > > omegaContext.globalTxId()
> > > > ...
> > > > }
> > > >
> > > > Any suggestion?
> > > >
> > > > Best regards,
> > > > Lei Zhang
> >
>

Reply via email to