Petals ESB Container

Better coherence between endpoint, service and interfaceName in MEX after endpoint selection

Details

  • Type: Improvement Request Improvement Request
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 5.0.0
  • Fix Version/s: 5.0.1
  • Component/s: Router
  • Security Level: Public
  • Description:
    Hide

    MessageExchange defines three methods to specify who will receive an exchange before it is sent.
    From the more specific to the less: setEndpoint(), setService() and setInterfaceName().

    Before the exchange is first sent, an incoherence between these is not a problem, since the router will take them in their specificity order and that's all.
    Once the exchange has been first sent, the JBI specification says that the elected endpoint can't change ANYMORE.

    What happens if:

    • The elected endpoint is not the one that was set with setEndpoint()?
    • The elected endpoint service name is not the one that was set with setService()?
    • The elected endpoint interfaces does not contain the one that was set with setInterfaceName()?

    Currently the behaviour is unclear and the information returned by the getXXX methods are not coherent with the elected endpoint.
    Worse, a component calling setEndpoint() can actually change the endpoint of the provider after it was elected.

    The following behaviour will fix this situation (i.e., after the endpoint election has happened):

    • getEndpoint() returns the elected endpoint except if there was one set manually (and that is not the elected one, for example when a fake endpoint is used).
    • getService() returns the elected endpoint's service name (even if setService() is called by a component again later).
    • getInterfaceName() returns
      • the interface set with setInterfaceName() if it is one of the endpoint's interfaces or if the endpoint has no interfaces.
      • the first interface of the endpoint if not (or if the interface name wasn't set with setInterfaceName()).

    Like this there can't be any incoherence. It is the responsibility of the component implementation not to expect the getXXX method to change their output even if it calls the setXXX methods after endpoint election has happened.

    Show
    MessageExchange defines three methods to specify who will receive an exchange before it is sent. From the more specific to the less: setEndpoint(), setService() and setInterfaceName(). Before the exchange is first sent, an incoherence between these is not a problem, since the router will take them in their specificity order and that's all. Once the exchange has been first sent, the JBI specification says that the elected endpoint can't change ANYMORE. What happens if:
    • The elected endpoint is not the one that was set with setEndpoint()?
    • The elected endpoint service name is not the one that was set with setService()?
    • The elected endpoint interfaces does not contain the one that was set with setInterfaceName()?
    Currently the behaviour is unclear and the information returned by the getXXX methods are not coherent with the elected endpoint. Worse, a component calling setEndpoint() can actually change the endpoint of the provider after it was elected. The following behaviour will fix this situation (i.e., after the endpoint election has happened):
    • getEndpoint() returns the elected endpoint except if there was one set manually (and that is not the elected one, for example when a fake endpoint is used).
    • getService() returns the elected endpoint's service name (even if setService() is called by a component again later).
    • getInterfaceName() returns
      • the interface set with setInterfaceName() if it is one of the endpoint's interfaces or if the endpoint has no interfaces.
      • the first interface of the endpoint if not (or if the interface name wasn't set with setInterfaceName()).
    Like this there can't be any incoherence. It is the responsibility of the component implementation not to expect the getXXX method to change their output even if it calls the setXXX methods after endpoint election has happened.
  • Environment:
    -

Activity

Hide
Christophe DENEUX added a comment - Thu, 14 Jan 2016 - 09:00:46 +0100

IMO, the existing method getEndpoint() should be renamed as getElectedEndpoint() to be more explicit. And you can add a new method returning the initial endpoint set: getEndpoint().
What does getElectedEndpoint() will return if no elected endpoint is set into the MEP ?

Show
Christophe DENEUX added a comment - Thu, 14 Jan 2016 - 09:00:46 +0100 IMO, the existing method getEndpoint() should be renamed as getElectedEndpoint() to be more explicit. And you can add a new method returning the initial endpoint set: getEndpoint(). What does getElectedEndpoint() will return if no elected endpoint is set into the MEP ?
Hide
Victor NOËL added a comment - Thu, 14 Jan 2016 - 09:19:02 +0100

There is two different thing: the public JBI api that we won't change and the petals internal API that we can manipulate.

What is said in the issue description concerns the JBI api.
As for the implementation (PetalsMessageExchange), in practice, I did add a getElectedEndpoint, but that's not very important here.
It returns null if there is no elected endpoint FYI.

Show
Victor NOËL added a comment - Thu, 14 Jan 2016 - 09:19:02 +0100 There is two different thing: the public JBI api that we won't change and the petals internal API that we can manipulate. What is said in the issue description concerns the JBI api. As for the implementation (PetalsMessageExchange), in practice, I did add a getElectedEndpoint, but that's not very important here. It returns null if there is no elected endpoint FYI.
Hide
Victor NOËL added a comment - Wed, 24 Feb 2016 - 13:23:11 +0100

updated description w.r.t. last commit

Show
Victor NOËL added a comment - Wed, 24 Feb 2016 - 13:23:11 +0100 updated description w.r.t. last commit

People

Dates

  • Created:
    Wed, 13 Jan 2016 - 16:03:09 +0100
    Updated:
    Wed, 24 Feb 2016 - 13:23:11 +0100
    Resolved:
    Thu, 14 Jan 2016 - 10:15:18 +0100