public override void StartListenerChannel(IListenerChannelCallback listenerChannelCallback, IAdphManager adphManager) { int channelId = listenerChannelCallback.GetId(); AppInstance appInstance; if (!this.appInstanceTable.TryGetValue(channelId, out appInstance)) { lock (ThisLock) { if (!this.appInstanceTable.TryGetValue(channelId, out appInstance)) { int length = listenerChannelCallback.GetBlobLength(); byte[] blob = new byte[length]; listenerChannelCallback.GetBlob(blob, ref length); appInstance = AppInstance.Deserialize(blob); appInstanceTable.Add(channelId, appInstance); } } } if (this.adphManager == null) { this.adphManager = adphManager; } Debug.Assert(channelId == appInstance.Id); this.adphManager.StartAppDomainProtocolListenerChannel(appInstance.AppKey, UdpConstants.Scheme, listenerChannelCallback); }
// Start per-process listening for messages public override void StartListenerChannel(IListenerChannelCallback listenerChannelCallback, IAdphManager adphManager) { DiagnosticUtility.DebugAssert(listenerChannelCallback != null, "The listenerChannelCallback parameter must not be null"); DiagnosticUtility.DebugAssert(adphManager != null, "The adphManager parameter must not be null"); int channelId = listenerChannelCallback.GetId(); ListenerChannelContext listenerChannelContext; lock (this.listenerChannelIdMapping) { if (!listenerChannelIdMapping.TryGetValue(channelId, out listenerChannelContext)) { int listenerChannelDataLength = listenerChannelCallback.GetBlobLength(); byte[] listenerChannelData = new byte[listenerChannelDataLength]; listenerChannelCallback.GetBlob(listenerChannelData, ref listenerChannelDataLength); Debug.Print("BaseProcessProtocolHandler.StartListenerChannel() GetBlob() contains " + listenerChannelDataLength + " bytes"); listenerChannelContext = ListenerChannelContext.Hydrate(listenerChannelData); this.listenerChannelIdMapping.Add(channelId, listenerChannelContext); Debug.Print("BaseProcessProtocolHandler.StartListenerChannel() listenerChannelContext.ListenerChannelId: " + listenerChannelContext.ListenerChannelId); } } if (this.adphManager == null) { this.adphManager = adphManager; } try { // wether or not a previous AppDomain was running, we're going to start a new one now: Debug.Print("BaseProcessProtocolHandler.StartListenerChannel() calling StartAppDomainProtocolListenerChannel(appKey:" + listenerChannelContext.AppKey + " protocolId:" + protocolId + ")"); adphManager.StartAppDomainProtocolListenerChannel(listenerChannelContext.AppKey, protocolId, listenerChannelCallback); } catch (Exception ex) { if (Fx.IsFatal(ex)) { throw; } DiagnosticUtility.TraceHandledException(ex, TraceEventType.Error); HandleStartListenerChannelError(listenerChannelCallback, ex); } }
public override void StartListenerChannel(IListenerChannelCallback listenerChannelCallback, IAdphManager adphManager) { _adphManager = adphManager; var channelId = listenerChannelCallback.GetId(); Trace.TraceInformation($"{nameof(RabbitMQTaskQueueProcessProtocolHandler)}.{nameof(StartListenerChannel)}: Starting listener channel for channel id [{channelId}]."); var setup = listenerChannelCallback.GetBlobAsListenerChannelSetup(); lock (_appInstanceTable) { if (!_appInstanceTable.ContainsKey(channelId)) { _appInstanceTable.Add(channelId, setup); } } adphManager.StartAppDomainProtocolListenerChannel(setup.ApplicationId, Constants.Scheme, listenerChannelCallback); Trace.TraceInformation($"{nameof(RabbitMQTaskQueueProcessProtocolHandler)}.{nameof(StartListenerChannel)}: Started listener channel for channel id [{channelId}]."); }
public abstract virtual void StartListenerChannel(IListenerChannelCallback listenerChannelCallback, IAdphManager AdphManager) {}
public abstract void StartListenerChannel(IListenerChannelCallback listenerChannelCallback, IAdphManager AdphManager);