Hans
Hans

Reputation: 2852

How to show the flow termination in Sequence Diagram

Basically, I'd like to depict the below logic in a Sequence Diagram:

if (ShopIsOpen) {
  if (AccessTokenIsExpired) {
    if (RefreshTokenInExpired) {
      return "Not Authorized";
    }
    IdentityServer.RequestAccessTokenByRefreshToken();
    return Resource.RequestResourceByAccessToken();
  }
} else {
  return "Shop is closed";
}

I've come up with the below diagram, but I am not sure if it is correct. Mainly, I am not sure if break in the diagram correctly communicates the intention of termination of flow: does it imply jumping out of the outer opt or the outer alt?

Any help is much appreciated.

enter image description here

Upvotes: 1

Views: 1742

Answers (1)

Axel Scheithauer
Axel Scheithauer

Reputation: 3680

The break fragment leaves the immediately enclosing fragment. In your case that would be the opt fragment. So, it is not correct. Why don’t you use nested alt fragments?

Some additional remarks: The reply to a synchronous message is shown with a dashed line and the returned value is shown with a leading colon (and the name of the original message, but I think it is obvious here anyway).

Upvotes: 1

Related Questions