@startuml
skinparam SequenceMessageAlign center
Actor "SAMSON" as Source
participant "HAProxy" as Gateway
participant "TIBCOCE" as TIBCOCE
participant "AAM" as AAM
participant "REEF" as REEF
participant "PublishEvent" as PublishEvent

Source -> Gateway : [[../DICE/ce.dsg.dice.mpcs.noFileFound.svg Source]] triggers event by invoking [[https://bitbucket.service.edp.t-mobile.com/projects/EITCODEDOC/repos/flow-documentation/browse/swagger/ce.dsg.dice.metro/PortInService.wsdl PortInService.notifyPortActivity]] SOAP call
	Gateway -> TIBCOCE : Receives request and routes it to TIBCOCE handler "PortIn.notifyPortActivity" 

		opt if requestorBillingSystem='METROPCS' in request
			TIBCOCE -> AAM : Invoke AAM's [[../DICE/ce.dsg.dice.mpcs.noFileFound.svg ChangeSubStsService.portOutDeactivation]] operation SOAP call
			AAM -> TIBCOCE : Return Response to TIBCOCE		

			opt if any error from AAM's [[../DICE/ce.dsg.dice.mpcs.noFileFound.svg ChangeSubStsService.portOutDeactivation]] operation call
				alt if TMO/Env/EventManagement/useTIBCOBEEventFramework="true"
					TIBCOCE -> REEF : Initiate [[../DICE/ce.dsg.dice.mpcs.portIn.notifyPortActivity.reef.svg REEFNotifyPortActivity]] flow by Publishing a message to JMS Queue 'TMOBILE.',$_globalVariables/pfx3:GlobalVariables/TMO/Env/Env_Name_BE,'.EVENTFRAMEWORK.REQUEST' (REEF)
					REEF -> TIBCOCE :
				else else
					TIBCOCE -> PublishEvent : Invoke [[../DICE/ce.dsg.dice.mpcs.publishEvent.postEvent.svg PublishEvent.postEvent]] operation by SOAP Call
					PublishEvent -> TIBCOCE : Return Response to TIBCOCE
				end
			end
		end
		
	TIBCOCE->Gateway : Return Response to Gateway
Gateway->Source : Return Response to Source
@enduml