I'm trying to create (IMO) pretty simple diagram:
If the system is not authenticated, then should sign in. If error occurred, then raise alarm and try again;
If the system is authenticated, then should ask for subscription.
The endpoint can return 401, in this case the arrow should go to the signing in step.
In other way, do something and go to start. (infinity algorithm)
@startuml
'https://plantuml.com/activity-diagram-beta
label start_process;
start
if (Is authenticated?) then (yes)
label ask_sub;
switch (Ask for the subscription)
case (Not authenticated)
goto log_in;
case (Subscription not exist)
:Create new subscription;
case (Subscription exist)
:Renew subscription;
endswitch
:Wait 5 min;
goto start_process;
else (no)
label log_in
:Sign in;
if (Success?) then (yes)
goto ask_sub;
else (No)
:Raise alarm;
:Wait 5 minutes;
goto start_process;
endif
endif
@enduml
But the final image is not what I expected
The lines from goto statement are hideous. Is there any way to fix it?
Edit:
I found that I can replace sign in statement with:
label sign_in;
repeat :Authenticate;
backward:Raise alarm;
repeat while (Success?)
goto ask_sub;
It's better, but still goto arrow is strange and empty arrow to "Not authenticated" branch
EDIT:
Got it, looks pretty good
@startuml
'https://plantuml.com/activity-diagram-beta
repeat :Find auth token in memory;
if (Is authenticated?) then (No)
label auth;
repeat :Authenticate;
backward:Raise alarm;
repeat while (Success?) is (No)
-> Yes;
:Remember auth token;
else (Yes)
endif
switch (Ask for the subscriptions)
case (Not authenticated error)
:Forgot auth token;
case (Subscription not exist)
:Create new subscription;
case (Subscription exist)
:Renew subscription;
endswitch
@enduml