Example #1
0
 /// <summary>
 /// This event will replace the default OnDisconnected functionality of the base class. It removes ServiceBus subscriptions and it will also
 /// remove <see cref="WorkflowBusSubscriber"/> from the relay. If this is not removed and the client has an id in storage, it will try to resume and
 /// wait for a complete message (Which will never arrive). Cleanup is therefore mandatory
 /// </summary>
 /// <param name="obj"></param>
 private void BusSubscriber_InstanceDone(WorkflowBusSubscriberDoneArgs obj)
 {
     //a status done or error was created.
     lock (WorkflowHubLock.GetLock(obj.Instance.CorrelationId))
     {
         //first make sure subscriptions are removed. The callback are attached to the hub subscriber object
         RemoveSubscriptionsForAsync(obj.Instance.CorrelationId).Wait();
         //wremvoe the subscriber will clean the hub subscriber and other dependencies
         WorkflowRelay.RemoveBusSubscriber(obj.Instance);
     }
 }
Example #2
0
        /// <summary>
        /// The default functionality will remove service bus subscribers. In our case we need thos esubscribers to still work
        /// </summary>
        /// <param name="stopCalled"></param>
        /// <returns></returns>
        public override Task OnDisconnected(bool stopCalled)
        {
            //prevent hub subscribers to send messages, the client is already disconnected
            lock (WorkflowHubLock.GetLock(Context.QueryString["correlationId"]))
            {
                string correlationId = Context.QueryString["correlationId"];

                //we remove all connections from the workflowhub to the browser
                WorkflowRelay.RemoveHubSubscribers(correlationId);

                //remove the signalR connection Id from the list of connections
                base.RemoveConnection();

                Logger.WriteWarning(new LogMessage("Client disconnected. Workflow service bus listeners remain active. SignalR subscribers are removed."), LogCategories);

                return(Task.CompletedTask);
            }
        }