/// <summary> /// Initializes communications with the outside world by means of remoting /// </summary> private void InitializeRemotingCommunications() { // Read the configuration file. RemotingConfiguration.Configure("..\\..\\App.config", false); WellKnownServiceTypeEntry[] wkst = RemotingConfiguration.GetRegisteredWellKnownServiceTypes(); // "Activate" the NameService singleton. objectDirectory = (ObjectDirectory)Activator.GetObject(typeof(ObjectDirectory), wkst[0].ObjectUri); // Bind the operational test faceade objectDirectory.Rebind(this, "OperationalTestFacade"); // Retreive the directory of messaging channels IChannelFactory channelFactory = (IChannelFactory)objectDirectory.Resolve("ChannelFactory"); // Retreive the Messaging Service channels we want to listen to rndfChannel = channelFactory.GetChannel("RndfNetworkChannel", ChannelMode.Bytestream); mdfChannel = channelFactory.GetChannel("MdfChannel", ChannelMode.Bytestream); positionChannel = channelFactory.GetChannel("PositionChannel", ChannelMode.Bytestream); testStringChannel = channelFactory.GetChannel("TestStringChannel", ChannelMode.Vanilla); // Create a channel listeners and listen on wanted channels channelListener = new MessagingListener(); rndfToken = rndfChannel.Subscribe(channelListener); mdfToken = mdfChannel.Subscribe(channelListener); //positionToken = positionChannel.Subscribe(channelListener); testStringToken = testStringChannel.Subscribe(new StringListener()); // Show that the navigation system is ready and waiting for input Console.WriteLine(" > Remoting Communication Initialized"); }
/// <summary> /// Publishes the MSG /// </summary> /// <param name="ticketId">Ticket Id</param> /// <param name="msg">The MSG</param> /// <param name="routingKey">The routing key</param> /// <param name="correlationId">The correlation identifier</param> /// <param name="replyRoutingKey">The reply routing key</param> /// <returns>IMqPublishResult</returns> /// <exception cref="InvalidOperationException">The instance is closed</exception> private IMqPublishResult PublishMsg(string ticketId, byte[] msg, string routingKey, string correlationId, string replyRoutingKey) { try { var channelWrapper = _channelFactory.GetChannel(UniqueId); CreateAndOpenPublisherChannel(); if (channelWrapper.ChannelBasicProperties == null) { throw new InvalidOperationException($"Channel {UniqueId} is not initiated."); } var channelBasicProperties = channelWrapper.ChannelBasicProperties; if (channelBasicProperties.Headers == null) { channelBasicProperties.Headers = new Dictionary <string, object>(); } if (!string.IsNullOrEmpty(correlationId)) { //_channelBasicProperties.Headers["correlationId"] = correlationId; channelBasicProperties.CorrelationId = correlationId; } if (!string.IsNullOrEmpty(replyRoutingKey)) { channelBasicProperties.Headers["replyRoutingKey"] = replyRoutingKey; } channelWrapper.Channel.BasicPublish(_mtsChannelSettings.ExchangeName, routingKey, channelBasicProperties, msg); FeedLog.LogDebug($"Publish of message with correlationId:{correlationId} and routingKey:{routingKey} succeeded."); _connectionStatus.TicketSend(ticketId); return(new MqPublishResult(correlationId)); } catch (Exception e) { FeedLog.LogError($"Publish of message with correlationId:{correlationId} and routingKey:{routingKey} failed.", e); return(new MqPublishResult(correlationId, false, e.Message)); } }
/// <summary> /// Handles the <see cref="EventingBasicConsumer.Received"/> event /// </summary> /// <param name="sender">The <see cref="object"/> representation of the instance raising the event</param> /// <param name="basicDeliverEventArgs">The <see cref="BasicDeliverEventArgs"/> instance containing the event data</param> private void OnDataReceived(object sender, BasicDeliverEventArgs basicDeliverEventArgs) { var correlationId = basicDeliverEventArgs?.BasicProperties?.CorrelationId ?? string.Empty; FeedLog.Info($"Received message from MTS with correlationId: {correlationId}."); ChannelMessageReceived?.Invoke(this, basicDeliverEventArgs); if (!_channelSettings.UserAcknowledgmentEnabled) { var i = 0; while (i < 10) { i++; try { var channelWrapper = _channelFactory.GetChannel(UniqueId); CreateAndOpenConsumerChannel(); channelWrapper.Channel.BasicAck(basicDeliverEventArgs?.DeliveryTag ?? 0, false); break; } catch (Exception e) { if (!e.Message.Contains("unknown delivery tag")) { FeedLog.Debug($"Sending Ack for processed message {basicDeliverEventArgs?.DeliveryTag} failed. {e.Message}"); } Thread.Sleep(i * 1000); } } } }
void OperationalInterface_Attached(object sender, OperationalInterface.AttachEventArgs e) { try { // clean up the old channels if they're set up if (obstacleChannel != null) { obstacleChannel.Dispose(); obstacleChannel = null; } /*if (trackedObstacleChannel != null) { * trackedObstacleChannel.Dispose(); * trackedObstacleChannel = null; * }*/ } catch (Exception) { } try { // get the channel factory IChannelFactory factory = (IChannelFactory)OperationalInterface.ObjectDirectory.Resolve("ChannelFactory"); if (string.IsNullOrEmpty(e.Suffix)) { // get the scene estimator all channel obstacleChannel = factory.GetChannel(SceneEstimatorObstacleChannelNames.AnyClusterChannelName, ChannelMode.UdpMulticast); //trackedObstacleChannel = null; } else { obstacleChannel = factory.GetChannel(SceneEstimatorObstacleChannelNames.UntrackedClusterChannelName + "_" + e.Suffix, ChannelMode.UdpMulticast); //trackedObstacleChannel = factory.GetChannel(SceneEstimatorObstacleChannelNames.TrackedClusterChannelName + "_" + suffix, ChannelMode.UdpMulticast); } } catch (Exception ex) { MessageBox.Show("Could not connect to scene estimator cluster channels: " + ex.Message); return; } if (obstacleChannel != null) { obstacleChannel.Subscribe(untrackedClusterAttacher); } /*if (trackedObstacleChannel != null) { * trackedObstacleChannel.Subscribe(clusters); * }*/ }
/// <summary> /// Registers with the correct services /// </summary> public void Register() { try { // "Activate" the NameService singleton. objectDirectory = (ObjectDirectory)Activator.GetObject(typeof(ObjectDirectory), wkst[0].ObjectUri); // Retreive the directory of messaging channels IChannelFactory channelFactory = (IChannelFactory)objectDirectory.Resolve("ChannelFactory"); // Retreive the Messaging Service channels we want to push to simulationMessageChannel = channelFactory.GetChannel("SimulationMessageChannel", ChannelMode.UdpMulticast); // Rebind the Simulator as the simulator remote facade server objectDirectory.Rebind(this, "SimulationServer"); // Notify user of success SimulatorOutput.WriteLine("Connection to Name Service and Registration of Simulation Server as Simulator Facade Successful"); // let clients know the sim is alive simulationMessageChannel.PublishUnreliably(SimulationMessage.Alive); } catch (Exception e) { SimulatorOutput.WriteLine("Error Registering With Remoting Services: " + e.ToString()); } }
public RabbitQueuePublisher(IChannelFactory channelFactory, IBaseSettings settings) { _settings = settings; _channel = channelFactory.GetChannel(); _channel.ExchangeDeclare(exchange: _settings.RabbitMq.ExchangeEthereumSamuraiErcContracts, type: "fanout", durable: true); _channel.ExchangeDeclare(exchange: _settings.RabbitMq.ExchangeEthereumSamuraiBlocks, type: "fanout", durable: true); _channel.ExchangeDeclare(exchange: _settings.RabbitMq.ExchangeEthereumSamuraiErcTransfer, type: "fanout", durable: true); }
public Broker(IChannelFactory channelFactory, IConfig conf, IAddressConfig addressConf) { this.channelFactory = channelFactory ?? throw new ArgumentNullException(nameof(channelFactory)); this.conf = conf ?? throw new ArgumentNullException(nameof(conf)); address = addressConf.Address; errorAddress = addressConf.ErrorAddress; channel = channelFactory.GetChannel(); }
private void Connect(ObjectDirectory od) { // get the channel for the sim state IChannelFactory channelFactory = (IChannelFactory)od.Resolve("ChannelFactory"); operationalStateChannel = channelFactory.GetChannel("OperationalSimState_" + SimulatorClient.MachineName, ChannelMode.Bytestream); // publish ourself to the object directory od.Rebind(this, "DynamicsSim_" + SimulatorClient.MachineName); }
public void Subscribe(string endpoint, string messageName) { try { endpoint = endpoint.ToLower(); var channel = channelFactory.GetChannel(); var queue = busConfig.EndpointName.ToLower(); var routingKey = messageName.IsNullOrEmpty() ? "#" : messageName; log.Info($"Subscribing to endpoint '{endpoint}'. Routingkey '{routingKey}'"); channel.QueueBind(queue, endpoint, routingKey); } catch (Exception ex) { log.Error($"Failed to subscribe to endpoint {endpoint}", ex); } }
public Task Consume(Func <BasicMessage, Task> onMessage) { this.onMessage = onMessage; channel = factory.GetChannel(); var consumer = new EventingBasicConsumer(channel); consumer.Received += OnReceivedMessage; channel.BasicConsume(queue, false, string.Empty, false, false, null, consumer); return(Task.CompletedTask); }
public Task Subscribe(string address, string messageName) { try { var channel = channelFactory.GetChannel(); var queue = addressConf.Address.ToLower(); var routingKey = messageName.IsNullOrEmpty() ? "#" : messageName; logger.LogInformation($"Subscribing to endpoint '{address}'. Routingkey '{routingKey}'"); channel.QueueBind(queue, address, routingKey); } catch (Exception ex) { logger.LogError($"Failed to subscribe to endpoint {address}", ex); } return(Task.CompletedTask); }
/// <summary> /// Registers with the correct services /// </summary> public void Register() { // "Activate" the NameService singleton. objectDirectory = (ObjectDirectory)Activator.GetObject(typeof(ObjectDirectory), wkst[0].ObjectUri); // Retreive the directory of messaging channels channelFactory = (IChannelFactory)objectDirectory.Resolve("ChannelFactory"); // register the core as implementing the arbiter advanced remote facade objectDirectory.Rebind(this.arbiterCore, "ArbiterAdvancedRemote" + this.RemotingSuffix); // shutdown old channels this.Shutdown(); // get vehicle state channel vehicleStateChannel = channelFactory.GetChannel("ArbiterSceneEstimatorPositionChannel" + this.RemotingSuffix, ChannelMode.UdpMulticast); vehicleStateChannelToken = vehicleStateChannel.Subscribe(messagingListener); // get observed obstacle channel observedObstacleChannel = channelFactory.GetChannel("ObservedObstacleChannel" + this.RemotingSuffix, ChannelMode.UdpMulticast); observedObstacleChannelToken = observedObstacleChannel.Subscribe(messagingListener); // get observed vehicle channel observedVehicleChannel = channelFactory.GetChannel("ObservedVehicleChannel" + this.RemotingSuffix, ChannelMode.UdpMulticast); observedVehicleChannelToken = observedVehicleChannel.Subscribe(messagingListener); // get vehicle speed channel vehicleSpeedChannel = channelFactory.GetChannel("VehicleSpeedChannel" + this.RemotingSuffix, ChannelMode.UdpMulticast); vehicleSpeedChannelToken = vehicleSpeedChannel.Subscribe(messagingListener); // get side obstacle channel sideObstacleChannel = channelFactory.GetChannel("SideObstacleChannel" + this.RemotingSuffix, ChannelMode.UdpMulticast); sideObstacleChannelToken = sideObstacleChannel.Subscribe(messagingListener); // get output channel if (arbiterOutputChannel != null) { arbiterOutputChannel.Dispose(); } arbiterOutputChannel = channelFactory.GetChannel("ArbiterOutputChannel" + this.RemotingSuffix, ChannelMode.UdpMulticast); // get information channel if (arbiterInformationChannel != null) { arbiterInformationChannel.Dispose(); } arbiterInformationChannel = channelFactory.GetChannel("ArbiterInformationChannel" + this.RemotingSuffix, ChannelMode.UdpMulticast); // get the operational layer this.operationalFacade = (OperationalFacade)objectDirectory.Resolve("OperationalService" + this.RemotingSuffix); this.operationalFacade.RegisterListener(this); this.SendProjection(); // try connecting to the test facade this.TryOperationalTestFacadeConnect(); }
/// <summary> /// /// </summary> /// <param name="action"></param> /// <param name="content"></param> /// <param name="headers"></param> /// <returns></returns> protected override Task <IResponseMessage> SendAsync(string action, Stream content, IDictionary <string, string> headers) { if (string.IsNullOrEmpty(Address)) { throw new ServiceException("service address not provided"); } if (_channel == null) { _channel = _channelFactory.GetChannel(Address); } return(_channel.SendAsync(action, content, headers)); }
public bool OnSessionEstablished(Session session) { if (_primaryChannel != null) { session.Connection.Disconnect(); return(false); } IPAddress localIp = GetLocalAddress(); _primaryChannel = _factory.GetChannel(session.Connection, session.IP.ToString(), session.RemotePort, localIp.ToString(), _sessionType, _traceProvider, _channelFormatter); if (!_primaryChannel.Connect(true)) { throw new DistributorException(ErrorCodes.Distributor.CHANNEL_CONNECT_FAILED, new string[] { _name, _primaryChannel.PeerAddress.IpAddress.ToString(), _primaryChannel.PeerAddress.Port.ToString() }); } return(true); }
public void RefreshList(IChannelFactory factory) { List <ListViewItem> removeItems = new List <ListViewItem>(); foreach (ChannelListViewItem item in Items) { if (item.DynamicChannel) { if (item.IsListening) { item.StopListening(); } removeItems.Add(item); } } foreach (ListViewItem item in removeItems) { Items.Remove(item); } ICollection <string> channels = null; try { channels = factory.Channels; } catch (Exception ex) { MessageBox.Show(this.FindForm(), "Could not get channels from channel factory:\n" + ex.Message, "Car Browser", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } List <ChannelListViewItem> items = new List <ChannelListViewItem>(); foreach (string name in channels) { try { IChannel channel = factory.GetChannel(name, ChannelMode.Bytestream); ChannelListViewItem item = new ChannelListViewItem(channel, this); items.Add(item); } catch (Exception) { } } Items.AddRange(items.ToArray()); }
public void ResgisterWithClient() { try { // get vehicle state channel vehicleStateChannel = channelFactory.GetChannel("ArbiterSceneEstimatorPositionChannel" + this.RemotingSuffix, ChannelMode.UdpMulticast); vehicleStateChannelToken = vehicleStateChannel.Subscribe(messagingListener); // get observed obstacle channel observedObstacleChannel = channelFactory.GetChannel("ObservedObstacleChannel" + this.RemotingSuffix, ChannelMode.UdpMulticast); observedObstacleChannelToken = observedObstacleChannel.Subscribe(messagingListener); // get observed vehicle channel observedVehicleChannel = channelFactory.GetChannel("ObservedVehicleChannel" + this.RemotingSuffix, ChannelMode.UdpMulticast); observedVehicleChannelToken = observedVehicleChannel.Subscribe(messagingListener); // get vehicle speed channel vehicleSpeedChannel = channelFactory.GetChannel("VehicleSpeedChannel" + this.RemotingSuffix, ChannelMode.UdpMulticast); vehicleSpeedChannelToken = vehicleSpeedChannel.Subscribe(messagingListener); // get output channel arbiterOutputChannel = channelFactory.GetChannel("ArbiterOutputChannel" + this.RemotingSuffix, ChannelMode.UdpMulticast); arbiterOutputChannelToken = arbiterOutputChannel.Subscribe(messagingListener); // get information channel arbiterInformationChannel = channelFactory.GetChannel("ArbiterInformationChannel" + this.RemotingSuffix, ChannelMode.UdpMulticast); arbiterInformationChannelToken = arbiterInformationChannel.Subscribe(messagingListener); // get side obstacle channel sideObstacleChannel = channelFactory.GetChannel("SideObstacleChannel" + this.RemotingSuffix, ChannelMode.UdpMulticast); sideObstacleChannelToken = sideObstacleChannel.Subscribe(messagingListener); // get ai this.arbiterRemote = (ArbiterAdvancedRemote)objectDirectory.Resolve("ArbiterAdvancedRemote" + this.RemotingSuffix); // get the operational layer this.operationalFacade = (OperationalFacade)objectDirectory.Resolve("OperationalService" + this.RemotingSuffix); // register RemoraOutput.WriteLine("Resgistered To Client with suffix: " + this.RemotingSuffix, OutputType.Remora); } catch (Exception e) { RemoraOutput.WriteLine("Error registering with client: " + e.ToString(), OutputType.Remora); } }
/// <summary> /// Configures remoting /// </summary> public void Configure() { // configure RemotingConfiguration.Configure("VehicleSeparationDisplay.exe.config", false); wkst = RemotingConfiguration.GetRegisteredWellKnownServiceTypes(); // "Activate" the NameService singleton. objectDirectory = (ObjectDirectory)Activator.GetObject(typeof(ObjectDirectory), wkst[0].ObjectUri); // Retreive the directory of messaging channels channelFactory = (IChannelFactory)objectDirectory.Resolve("ChannelFactory"); // Notify user of success Console.WriteLine("Connection to Name Service Successful"); // get information channel arbiterInformationChannel = channelFactory.GetChannel("ArbiterInformationChannel" + this.RemotingSuffix, ChannelMode.UdpMulticast); arbiterInformationChannelToken = arbiterInformationChannel.Subscribe(messagingListener); }
public void RefreshList(IChannelFactory factory) { List<ListViewItem> removeItems = new List<ListViewItem>(); foreach (ChannelListViewItem item in Items) { if (item.DynamicChannel) { if (item.IsListening) { item.StopListening(); } removeItems.Add(item); } } foreach (ListViewItem item in removeItems) { Items.Remove(item); } ICollection<string> channels = null; try { channels = factory.Channels; } catch (Exception ex) { MessageBox.Show(this.FindForm(), "Could not get channels from channel factory:\n" + ex.Message, "Car Browser", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } List<ChannelListViewItem> items = new List<ChannelListViewItem>(); foreach (string name in channels) { try { IChannel channel = factory.GetChannel(name, ChannelMode.Bytestream); ChannelListViewItem item = new ChannelListViewItem(channel, this); items.Add(item); } catch (Exception) { } } Items.AddRange(items.ToArray()); }
/// <summary> /// Initializes communications with the outside world by means of remoting /// </summary> public void InitializeRemotingCommunications() { // try to shut down in case we have already been active this.ShutDown(); try { // Read the configuration file. RemotingConfiguration.Configure("Remora.exe.config", false); WellKnownServiceTypeEntry[] wkst = RemotingConfiguration.GetRegisteredWellKnownServiceTypes(); // "Activate" the NameService singleton. objectDirectory = (ObjectDirectory)Activator.GetObject(typeof(ObjectDirectory), wkst[0].ObjectUri); // Retreive the directory of messaging channels IChannelFactory channelFactory = (IChannelFactory)objectDirectory.Resolve("ChannelFactory"); // Retreive the Messaging Service channels we want to listen to vehicleStateChannel = channelFactory.GetChannel("PositionChannel", ChannelMode.UdpMulticast); observedObstacleChannel = channelFactory.GetChannel("ObservedObstacleChannel", ChannelMode.UdpMulticast); observedVehicleChannel = channelFactory.GetChannel("ObservedVehicleChannel", ChannelMode.UdpMulticast); arbiterInformationChannel = channelFactory.GetChannel("ArbiterInformationChannel", ChannelMode.UdpMulticast); carModeChannel = channelFactory.GetChannel("CarMode", ChannelMode.UdpMulticast); fakeVehicleChannel = channelFactory.GetChannel("FakeVehicleChannel", ChannelMode.UdpMulticast); // Create a channel listeners and listen on wanted channels channelListener = new MessagingListener(); vehicleStateChannelToken = vehicleStateChannel.Subscribe(channelListener); observedObstacleChannel.Subscribe(channelListener); observedVehicleChannel.Subscribe(channelListener); arbiterInformationChannelToken = arbiterInformationChannel.Subscribe(channelListener); carModeChannelToken = carModeChannel.Subscribe(channelListener); fakeVehicleChannelToken = fakeVehicleChannel.Subscribe(channelListener); // set that remoting has been successfully initialize this.RemotingInitialized = true; RemoraOutput.WriteLine("Successfully initialized communications"); } catch (Exception e) { RemoraOutput.WriteLine(e.ToString() + "\n\n" + "Could not initialize communications, attempting to reconnect"); try { WellKnownServiceTypeEntry[] wkst = RemotingConfiguration.GetRegisteredWellKnownServiceTypes(); // "Activate" the NameService singleton. objectDirectory = (ObjectDirectory)Activator.GetObject(typeof(ObjectDirectory), wkst[0].ObjectUri); // Retreive the directory of messaging channels IChannelFactory channelFactory = (IChannelFactory)objectDirectory.Resolve("ChannelFactory"); // Retreive the Messaging Service channels we want to listen to vehicleStateChannel = channelFactory.GetChannel("PositionChannel", ChannelMode.UdpMulticast); observedObstacleChannel = channelFactory.GetChannel("ObservedObstacleChannel", ChannelMode.UdpMulticast); observedVehicleChannel = channelFactory.GetChannel("ObservedVehicleChannel", ChannelMode.UdpMulticast); arbiterInformationChannel = channelFactory.GetChannel("ArbiterInformationChannel", ChannelMode.UdpMulticast); carModeChannel = channelFactory.GetChannel("CarMode", ChannelMode.UdpMulticast); fakeVehicleChannel = channelFactory.GetChannel("FakeVehicleChannel", ChannelMode.UdpMulticast); // Create a channel listeners and listen on wanted channels channelListener = new MessagingListener(); vehicleStateChannelToken = vehicleStateChannel.Subscribe(channelListener); observedObstacleChannel.Subscribe(channelListener); observedVehicleChannel.Subscribe(channelListener); arbiterInformationChannelToken = arbiterInformationChannel.Subscribe(channelListener); carModeChannelToken = carModeChannel.Subscribe(channelListener); fakeVehicleChannelToken = fakeVehicleChannel.Subscribe(channelListener); // set that remoting has been successfully initialize this.RemotingInitialized = true; RemoraOutput.WriteLine("Successfully initialized communications"); } catch (Exception e1) { RemoraOutput.WriteLine(e1.ToString() + "\n\n" + "Could not reinitialize nameservice communications"); try { // Retreive the directory of messaging channels IChannelFactory channelFactory = (IChannelFactory)objectDirectory.Resolve("ChannelFactory"); // Retreive the Messaging Service channels we want to listen to vehicleStateChannel = channelFactory.GetChannel("PositionChannel", ChannelMode.UdpMulticast); observedObstacleChannel = channelFactory.GetChannel("ObservedObstacleChannel", ChannelMode.UdpMulticast); observedVehicleChannel = channelFactory.GetChannel("ObservedVehicleChannel", ChannelMode.UdpMulticast); arbiterInformationChannel = channelFactory.GetChannel("ArbiterInformationChannel", ChannelMode.UdpMulticast); carModeChannel = channelFactory.GetChannel("CarMode", ChannelMode.UdpMulticast); fakeVehicleChannel = channelFactory.GetChannel("FakeVehicleChannel", ChannelMode.UdpMulticast); // Create a channel listeners and listen on wanted channels channelListener = new MessagingListener(); vehicleStateChannelToken = vehicleStateChannel.Subscribe(channelListener); observedObstacleChannel.Subscribe(channelListener); observedVehicleChannel.Subscribe(channelListener); arbiterInformationChannelToken = arbiterInformationChannel.Subscribe(channelListener); carModeChannelToken = carModeChannel.Subscribe(channelListener); fakeVehicleChannelToken = fakeVehicleChannel.Subscribe(channelListener); // set that remoting has been successfully initialize this.RemotingInitialized = true; RemoraOutput.WriteLine("Successfully initialized communications"); } catch (Exception e2) { RemoraOutput.WriteLine(e2.ToString() + "\n\n" + "Could not reinitialize messaging communications"); } } } }
/// <summary> /// Configures remoting /// </summary> public void Configure() { // configure RemotingConfiguration.Configure("VehicleSeparationDisplay.exe.config", false); wkst = RemotingConfiguration.GetRegisteredWellKnownServiceTypes(); // "Activate" the NameService singleton. objectDirectory = (ObjectDirectory)Activator.GetObject(typeof(ObjectDirectory), wkst[0].ObjectUri); // Retreive the directory of messaging channels channelFactory = (IChannelFactory)objectDirectory.Resolve("ChannelFactory"); // Notify user of success Console.WriteLine("Connection to Name Service Successful"); // get information channel arbiterInformationChannel = channelFactory.GetChannel("ArbiterInformationChannel" + this.RemotingSuffix, ChannelMode.UdpMulticast); arbiterInformationChannelToken = arbiterInformationChannel.Subscribe(messagingListener); }
private void RestoreChannel() { channel = channelFactory.GetChannel(); }
public static IChannel GetChannel(string name) { return(channelFactory.GetChannel(BuildServiceName(name), ChannelMode.Bytestream)); }
protected RabbitMQChannel(IChannelFactory channelFactory) { this.channelFactory = channelFactory; this.channel = channelFactory.GetChannel(); }
/// <summary> /// Registers with the correct services /// </summary> public void Register() { try { // "Activate" the NameService singleton. objectDirectory = (ObjectDirectory)Activator.GetObject(typeof(ObjectDirectory), wkst[0].ObjectUri); // Retreive the directory of messaging channels IChannelFactory channelFactory = (IChannelFactory)objectDirectory.Resolve("ChannelFactory"); // Retreive the Messaging Service channels we want to interact with if (simulationMessageChannel != null) { simulationMessageChannel.Dispose(); } simulationMessageChannel = channelFactory.GetChannel("SimulationMessageChannel", ChannelMode.UdpMulticast); // Listen to channels we wish to listen to simulationMessageChannelToken = simulationMessageChannel.Subscribe(this.messagingListener); // Rebind the Simulator as the simulator remote facade server objectDirectory.Rebind(this.client, this.client.Name()); // get vehicle state channel if (vehicleStateChannel != null) { vehicleStateChannel.Dispose(); } vehicleStateChannel = channelFactory.GetChannel("ArbiterSceneEstimatorPositionChannel_" + SimulatorClient.MachineName, ChannelMode.Bytestream); // get observed obstacle channel if (observedObstacleChannel != null) { observedObstacleChannel.Dispose(); } observedObstacleChannel = channelFactory.GetChannel("ObservedObstacleChannel_" + SimulatorClient.MachineName, ChannelMode.Bytestream); // get observed vehicle channel if (observedVehicleChannel != null) { observedVehicleChannel.Dispose(); } observedVehicleChannel = channelFactory.GetChannel("ObservedVehicleChannel_" + SimulatorClient.MachineName, ChannelMode.Bytestream); // get vehicle speed channel if (vehicleSpeedChannel != null) { vehicleSpeedChannel.Dispose(); } vehicleSpeedChannel = channelFactory.GetChannel("VehicleSpeedChannel_" + SimulatorClient.MachineName, ChannelMode.Bytestream); // get the local road estimate channel if (localRoadChannel != null) { localRoadChannel.Dispose(); } localRoadChannel = channelFactory.GetChannel(LocalRoadEstimate.ChannelName + "_" + SimulatorClient.MachineName, ChannelMode.Bytestream); // Notify user of success Console.WriteLine(DateTime.Now.ToString() + ": Connection to Name Service and Registration of Simulation Client Successful"); } catch (Exception e) { // notify Console.WriteLine(DateTime.Now.ToString() + ": Error Registering With Remoting Services: " + e.ToString()); } }