You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicecomb.apache.org by Zhang Lei <co...@gmail.com> on 2019/11/12 15:34:33 UTC

Simplify user usage if the OmegaContext parameter is defined in the @SagaStart or @Compensable annotation method

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

Re: Simplify user usage if the OmegaContext parameter is defined in the @SagaStart or @Compensable annotation method

Posted by Zhang Lei <co...@gmail.com>.
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.jiang@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 <co...@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

Re: Simplify user usage if the OmegaContext parameter is defined in the @SagaStart or @Compensable annotation method

Posted by Zhang Lei <co...@gmail.com>.
Ok, I create a JIRA https://issues.apache.org/jira/browse/SCB-1596

Best regards,
Lei Zhang

On November 15, 2019 at 3:51:40 PM, Willem Jiang (willem.jiang@gmail.com)
wrote:

+1.
@Zhanglei do you mind create a JIRA for it?


Willem Jiang

Twitter: willemjiang
Weibo: 姜宁willem

On Thu, Nov 14, 2019 at 12:39 PM Zhang Lei <co...@gmail.com> wrote:
>
> If the user defines the parameter OmegaContext in the method we pass,
> otherwise ignore...
>
>
> Best regards,
> Lei Zhang
>
> On November 14, 2019 at 11:56:49 AM, Zheng Feng (zh.feng@gmail.com)
wrote:
>
> In the other word, if the user pass the OmegaContext which is NOT null,
we
> DO NOT inject the instance currently ? or just ignore it ?
> How about if passing the new OmegaContext ?
>
> service.booking(new OmegaContext());
>
> it could be a little bit confusing here.
>
> Willem Jiang <wi...@gmail.com> 于2019年11月14日周四 上午11:14写道:
>
> > This method is called by servlet implementation, so the user won't
> > call that method.
> > I think we can support to let the user pass OmegaContext as null
> > object when calling the method.
> > And we can inject the runtime OmegaContext instance to as a parameter
> > when the parameter is null.
> >
> >
> > Willem Jiang
> >
> > Twitter: willemjiang
> > Weibo: 姜宁willem
> >
> > On Thu, Nov 14, 2019 at 10:51 AM Zhang Lei <co...@gmail.com>
wrote:
> > >
> > > We can refer to the method annotation of spring MVC. The parameter
> > > HttpServletRequest is optional
> > >
> > > @RequestMapping(xxxx)
> > > public void doXXXX(HttpServletRequest request){
> > >
> > > }
> > >
> > > Best regards,
> > > Lei Zhang
> > >
> > > On November 14, 2019 at 10:06:57 AM, Zheng Feng (zh.feng@gmail.com)
> > wrote:
> > >
> > > But how can we reference this parameter in the method ? I don't think
> the
> > > Java support this kind of syntax.
> > >
> > > Willem Jiang <wi...@gmail.com> 于2019年11月14日周四 上午9:43写道:
> > >
> > > > Can I invoke the booking method like this ?
> > > > booking().
> > > >
> > > > Then, the OmegaContext would be inject as a parameter?
> > > >
> > > > Willem Jiang
> > > >
> > > > Twitter: willemjiang
> > > > Weibo: 姜宁willem
> > > >
> > > > On Thu, Nov 14, 2019 at 9:34 AM Zheng Feng <zh...@gmail.com>
wrote:
> > > > >
> > > > > 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 <co...@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.feng@gmail.com)
>
> > > > wrote:
> > > > > >
> > > > > > I'm not very clear what could be benefited from these changes ?
> > with
> > > > > > declaring the OmegaContext explicitly ?
> > > > > >
> > > > > > Willem Jiang <wi...@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 <
coolbeevip@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.jiang@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 <
> > coolbeevip@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
> > > > > > >
> > > > > >
> > > >
> >

Re: Simplify user usage if the OmegaContext parameter is defined in the @SagaStart or @Compensable annotation method

Posted by Willem Jiang <wi...@gmail.com>.
+1.
@Zhanglei do you mind create a JIRA for it?


Willem Jiang

Twitter: willemjiang
Weibo: 姜宁willem

On Thu, Nov 14, 2019 at 12:39 PM Zhang Lei <co...@gmail.com> wrote:
>
> If the user defines the parameter OmegaContext in the method we pass,
> otherwise ignore...
>
>
> Best regards,
> Lei Zhang
>
> On November 14, 2019 at 11:56:49 AM, Zheng Feng (zh.feng@gmail.com) wrote:
>
> In the other word, if the user pass the OmegaContext which is NOT null, we
> DO NOT inject the instance currently ? or just ignore it ?
> How about if passing the new OmegaContext ?
>
> service.booking(new OmegaContext());
>
> it could be a little bit confusing here.
>
> Willem Jiang <wi...@gmail.com> 于2019年11月14日周四 上午11:14写道:
>
> > This method is called by servlet implementation, so the user won't
> > call that method.
> > I think we can support to let the user pass OmegaContext as null
> > object when calling the method.
> > And we can inject the runtime OmegaContext instance to as a parameter
> > when the parameter is null.
> >
> >
> > Willem Jiang
> >
> > Twitter: willemjiang
> > Weibo: 姜宁willem
> >
> > On Thu, Nov 14, 2019 at 10:51 AM Zhang Lei <co...@gmail.com> wrote:
> > >
> > > We can refer to the method annotation of spring MVC. The parameter
> > > HttpServletRequest is optional
> > >
> > > @RequestMapping(xxxx)
> > > public void doXXXX(HttpServletRequest request){
> > >
> > > }
> > >
> > > Best regards,
> > > Lei Zhang
> > >
> > > On November 14, 2019 at 10:06:57 AM, Zheng Feng (zh.feng@gmail.com)
> > wrote:
> > >
> > > But how can we reference this parameter in the method ? I don't think
> the
> > > Java support this kind of syntax.
> > >
> > > Willem Jiang <wi...@gmail.com> 于2019年11月14日周四 上午9:43写道:
> > >
> > > > Can I invoke the booking method like this ?
> > > > booking().
> > > >
> > > > Then, the OmegaContext would be inject as a parameter?
> > > >
> > > > Willem Jiang
> > > >
> > > > Twitter: willemjiang
> > > > Weibo: 姜宁willem
> > > >
> > > > On Thu, Nov 14, 2019 at 9:34 AM Zheng Feng <zh...@gmail.com> wrote:
> > > > >
> > > > > 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 <co...@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.feng@gmail.com)
>
> > > > wrote:
> > > > > >
> > > > > > I'm not very clear what could be benefited from these changes ?
> > with
> > > > > > declaring the OmegaContext explicitly ?
> > > > > >
> > > > > > Willem Jiang <wi...@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 <co...@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.jiang@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 <
> > coolbeevip@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
> > > > > > >
> > > > > >
> > > >
> >

Re: Simplify user usage if the OmegaContext parameter is defined in the @SagaStart or @Compensable annotation method

Posted by Zhang Lei <co...@gmail.com>.
If the user defines the parameter OmegaContext in the method we pass,
otherwise ignore...


Best regards,
Lei Zhang

On November 14, 2019 at 11:56:49 AM, Zheng Feng (zh.feng@gmail.com) wrote:

In the other word, if the user pass the OmegaContext which is NOT null, we
DO NOT inject the instance currently ? or just ignore it ?
How about if passing the new OmegaContext ?

service.booking(new OmegaContext());

it could be a little bit confusing here.

Willem Jiang <wi...@gmail.com> 于2019年11月14日周四 上午11:14写道:

> This method is called by servlet implementation, so the user won't
> call that method.
> I think we can support to let the user pass OmegaContext as null
> object when calling the method.
> And we can inject the runtime OmegaContext instance to as a parameter
> when the parameter is null.
>
>
> Willem Jiang
>
> Twitter: willemjiang
> Weibo: 姜宁willem
>
> On Thu, Nov 14, 2019 at 10:51 AM Zhang Lei <co...@gmail.com> wrote:
> >
> > We can refer to the method annotation of spring MVC. The parameter
> > HttpServletRequest is optional
> >
> > @RequestMapping(xxxx)
> > public void doXXXX(HttpServletRequest request){
> >
> > }
> >
> > Best regards,
> > Lei Zhang
> >
> > On November 14, 2019 at 10:06:57 AM, Zheng Feng (zh.feng@gmail.com)
> wrote:
> >
> > But how can we reference this parameter in the method ? I don't think
the
> > Java support this kind of syntax.
> >
> > Willem Jiang <wi...@gmail.com> 于2019年11月14日周四 上午9:43写道:
> >
> > > Can I invoke the booking method like this ?
> > > booking().
> > >
> > > Then, the OmegaContext would be inject as a parameter?
> > >
> > > Willem Jiang
> > >
> > > Twitter: willemjiang
> > > Weibo: 姜宁willem
> > >
> > > On Thu, Nov 14, 2019 at 9:34 AM Zheng Feng <zh...@gmail.com> wrote:
> > > >
> > > > 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 <co...@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.feng@gmail.com)

> > > wrote:
> > > > >
> > > > > I'm not very clear what could be benefited from these changes ?
> with
> > > > > declaring the OmegaContext explicitly ?
> > > > >
> > > > > Willem Jiang <wi...@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 <co...@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.jiang@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 <
> coolbeevip@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
> > > > > >
> > > > >
> > >
>

Re: Simplify user usage if the OmegaContext parameter is defined in the @SagaStart or @Compensable annotation method

Posted by Zheng Feng <zh...@gmail.com>.
In the other word, if the user pass the OmegaContext which is NOT null, we
DO NOT inject the instance currently ? or just ignore it ?
How about if passing the new OmegaContext ?

service.booking(new OmegaContext());

it could be a little bit confusing here.

Willem Jiang <wi...@gmail.com> 于2019年11月14日周四 上午11:14写道:

> This method is called by servlet implementation, so the user won't
> call that method.
> I think we can support to let the user pass OmegaContext as null
> object when calling the method.
> And we can inject the runtime OmegaContext instance to as a parameter
> when the parameter is null.
>
>
> Willem Jiang
>
> Twitter: willemjiang
> Weibo: 姜宁willem
>
> On Thu, Nov 14, 2019 at 10:51 AM Zhang Lei <co...@gmail.com> wrote:
> >
> > We can refer to the method annotation of spring MVC. The parameter
> > HttpServletRequest is optional
> >
> > @RequestMapping(xxxx)
> > public void doXXXX(HttpServletRequest request){
> >
> > }
> >
> > Best regards,
> > Lei Zhang
> >
> > On November 14, 2019 at 10:06:57 AM, Zheng Feng (zh.feng@gmail.com)
> wrote:
> >
> > But how can we reference this parameter in the method ? I don't think the
> > Java support this kind of syntax.
> >
> > Willem Jiang <wi...@gmail.com> 于2019年11月14日周四 上午9:43写道:
> >
> > > Can I invoke the booking method like this ?
> > > booking().
> > >
> > > Then, the OmegaContext would be inject as a parameter?
> > >
> > > Willem Jiang
> > >
> > > Twitter: willemjiang
> > > Weibo: 姜宁willem
> > >
> > > On Thu, Nov 14, 2019 at 9:34 AM Zheng Feng <zh...@gmail.com> wrote:
> > > >
> > > > 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 <co...@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.feng@gmail.com)
> > > wrote:
> > > > >
> > > > > I'm not very clear what could be benefited from these changes ?
> with
> > > > > declaring the OmegaContext explicitly ?
> > > > >
> > > > > Willem Jiang <wi...@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 <co...@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.jiang@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 <
> coolbeevip@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
> > > > > >
> > > > >
> > >
>

Re: Simplify user usage if the OmegaContext parameter is defined in the @SagaStart or @Compensable annotation method

Posted by Willem Jiang <wi...@gmail.com>.
This method is called by servlet implementation, so the user won't
call that method.
I think we can support to let the user pass OmegaContext as null
object when calling the method.
And we can inject the runtime OmegaContext instance to as a parameter
when the parameter is null.


Willem Jiang

Twitter: willemjiang
Weibo: 姜宁willem

On Thu, Nov 14, 2019 at 10:51 AM Zhang Lei <co...@gmail.com> wrote:
>
> We can refer to the method annotation of spring MVC. The parameter
> HttpServletRequest is optional
>
> @RequestMapping(xxxx)
> public void doXXXX(HttpServletRequest request){
>
> }
>
> Best regards,
> Lei Zhang
>
> On November 14, 2019 at 10:06:57 AM, Zheng Feng (zh.feng@gmail.com) wrote:
>
> But how can we reference this parameter in the method ? I don't think the
> Java support this kind of syntax.
>
> Willem Jiang <wi...@gmail.com> 于2019年11月14日周四 上午9:43写道:
>
> > Can I invoke the booking method like this ?
> > booking().
> >
> > Then, the OmegaContext would be inject as a parameter?
> >
> > Willem Jiang
> >
> > Twitter: willemjiang
> > Weibo: 姜宁willem
> >
> > On Thu, Nov 14, 2019 at 9:34 AM Zheng Feng <zh...@gmail.com> wrote:
> > >
> > > 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 <co...@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.feng@gmail.com)
> > wrote:
> > > >
> > > > I'm not very clear what could be benefited from these changes ? with
> > > > declaring the OmegaContext explicitly ?
> > > >
> > > > Willem Jiang <wi...@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 <co...@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.jiang@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 <co...@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
> > > > >
> > > >
> >

Re: Simplify user usage if the OmegaContext parameter is defined in the @SagaStart or @Compensable annotation method

Posted by Zheng Feng <zh...@gmail.com>.
OK, I get it. So the HttpServletRequest request has been injected
automatically just when we declare it in the method signatures.
Is there any difference between this declaration and the @Autowired ?
Do we need to guarantee that this is thread-safe ?

anyway, these should be documented very well and make sure the users
understand the usages.


Zhang Lei <co...@gmail.com> 于2019年11月14日周四 上午10:51写道:

> We can refer to the method annotation of spring MVC. The parameter
> HttpServletRequest is optional
>
> @RequestMapping(xxxx)
> public void doXXXX(HttpServletRequest request){
>
> }
>
> Best regards,
> Lei Zhang
>
> On November 14, 2019 at 10:06:57 AM, Zheng Feng (zh.feng@gmail.com) wrote:
>
> But how can we reference this parameter in the method ? I don't think the
> Java support this kind of syntax.
>
> Willem Jiang <wi...@gmail.com> 于2019年11月14日周四 上午9:43写道:
>
> > Can I invoke the booking method like this ?
> > booking().
> >
> > Then, the OmegaContext would be inject as a parameter?
> >
> > Willem Jiang
> >
> > Twitter: willemjiang
> > Weibo: 姜宁willem
> >
> > On Thu, Nov 14, 2019 at 9:34 AM Zheng Feng <zh...@gmail.com> wrote:
> > >
> > > 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 <co...@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.feng@gmail.com)
> > wrote:
> > > >
> > > > I'm not very clear what could be benefited from these changes ? with
> > > > declaring the OmegaContext explicitly ?
> > > >
> > > > Willem Jiang <wi...@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 <co...@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.jiang@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 <coolbeevip@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
> > > > >
> > > >
> >
>

Re: Simplify user usage if the OmegaContext parameter is defined in the @SagaStart or @Compensable annotation method

Posted by Zhang Lei <co...@gmail.com>.
We can refer to the method annotation of spring MVC. The parameter
HttpServletRequest is optional

@RequestMapping(xxxx)
public void doXXXX(HttpServletRequest request){

}

Best regards,
Lei Zhang

On November 14, 2019 at 10:06:57 AM, Zheng Feng (zh.feng@gmail.com) wrote:

But how can we reference this parameter in the method ? I don't think the
Java support this kind of syntax.

Willem Jiang <wi...@gmail.com> 于2019年11月14日周四 上午9:43写道:

> Can I invoke the booking method like this ?
> booking().
>
> Then, the OmegaContext would be inject as a parameter?
>
> Willem Jiang
>
> Twitter: willemjiang
> Weibo: 姜宁willem
>
> On Thu, Nov 14, 2019 at 9:34 AM Zheng Feng <zh...@gmail.com> wrote:
> >
> > 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 <co...@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.feng@gmail.com)
> wrote:
> > >
> > > I'm not very clear what could be benefited from these changes ? with
> > > declaring the OmegaContext explicitly ?
> > >
> > > Willem Jiang <wi...@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 <co...@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.jiang@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 <co...@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
> > > >
> > >
>

Re: Simplify user usage if the OmegaContext parameter is defined in the @SagaStart or @Compensable annotation method

Posted by Zheng Feng <zh...@gmail.com>.
But how can we reference this parameter in the method ? I don't think the
Java support this kind of syntax.

Willem Jiang <wi...@gmail.com> 于2019年11月14日周四 上午9:43写道:

> Can I invoke the booking method like this ?
> booking().
>
> Then, the OmegaContext would be inject as a parameter?
>
> Willem Jiang
>
> Twitter: willemjiang
> Weibo: 姜宁willem
>
> On Thu, Nov 14, 2019 at 9:34 AM Zheng Feng <zh...@gmail.com> wrote:
> >
> > 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 <co...@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.feng@gmail.com)
> wrote:
> > >
> > > I'm not very clear what could be benefited from these changes ? with
> > > declaring the OmegaContext explicitly ?
> > >
> > > Willem Jiang <wi...@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 <co...@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.jiang@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 <co...@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
> > > >
> > >
>

Re: Simplify user usage if the OmegaContext parameter is defined in the @SagaStart or @Compensable annotation method

Posted by Willem Jiang <wi...@gmail.com>.
Can I invoke the booking method like this ?
booking().

Then, the OmegaContext would be inject as a parameter?

Willem Jiang

Twitter: willemjiang
Weibo: 姜宁willem

On Thu, Nov 14, 2019 at 9:34 AM Zheng Feng <zh...@gmail.com> wrote:
>
> 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 <co...@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.feng@gmail.com) wrote:
> >
> > I'm not very clear what could be benefited from these changes ? with
> > declaring the OmegaContext explicitly ?
> >
> > Willem Jiang <wi...@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 <co...@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.jiang@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 <co...@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
> > >
> >

Re: Simplify user usage if the OmegaContext parameter is defined in the @SagaStart or @Compensable annotation method

Posted by Zheng Feng <zh...@gmail.com>.
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 <co...@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.feng@gmail.com) wrote:
>
> I'm not very clear what could be benefited from these changes ? with
> declaring the OmegaContext explicitly ?
>
> Willem Jiang <wi...@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 <co...@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.jiang@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 <co...@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
> >
>

Re: Simplify user usage if the OmegaContext parameter is defined in the @SagaStart or @Compensable annotation method

Posted by Zhang Lei <co...@gmail.com>.
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.feng@gmail.com) wrote:

I'm not very clear what could be benefited from these changes ? with
declaring the OmegaContext explicitly ?

Willem Jiang <wi...@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 <co...@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.jiang@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 <co...@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
>

Re: Simplify user usage if the OmegaContext parameter is defined in the @SagaStart or @Compensable annotation method

Posted by Zheng Feng <zh...@gmail.com>.
I'm not very clear what could be benefited from these changes ? with
declaring the OmegaContext explicitly ?

Willem Jiang <wi...@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 <co...@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.jiang@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 <co...@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
>

Re: Simplify user usage if the OmegaContext parameter is defined in the @SagaStart or @Compensable annotation method

Posted by Willem Jiang <wi...@gmail.com>.
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 <co...@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.jiang@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 <co...@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

Re: Simplify user usage if the OmegaContext parameter is defined in the @SagaStart or @Compensable annotation method

Posted by Zhang Lei <co...@gmail.com>.
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.jiang@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 <co...@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

Re: Simplify user usage if the OmegaContext parameter is defined in the @SagaStart or @Compensable annotation method

Posted by Willem Jiang <wi...@gmail.com>.
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 <co...@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