public static void Main(string[] args) { try { // Sets window size and cursor color Console.SetWindowSize(130, 30); Console.ForegroundColor = ConsoleColor.White; // Reads configuration settings ReadConfiguration(); // Sets actor service URIs workerActorServiceUri = ActorNameFormat.GetFabricServiceUri(typeof(IWorkerActor), ApplicationName); queueActorServiceUri = ActorNameFormat.GetFabricServiceUri(typeof(IQueueActor), ApplicationName); processorActorServiceUri = ActorNameFormat.GetFabricServiceUri(typeof(IProcessorActor), ApplicationName); int i; while ((i = SelectOption()) != TestList.Count + 1) { try { PrintTestParameters(TestList[i - 1].Name); TestList[i - 1].Action(); } catch (Exception ex) { PrintException(ex); } } } catch (Exception ex) { PrintException(ex); } }
public WebFront(StatelessServiceContext context) : base(context) { this.LoadLiveCounterSettings(); this.counter = new LivenessCounter <string>(expirationIntervalInSeconds, fuzzIntervalInSeconds); nodeName = context.NodeContext.NodeName; serviceUri = ActorNameFormat.GetFabricServiceUri(typeof(IContainerAggregatorActor)); proxy = ActorServiceProxy.Create <IContainerAggregator>(serviceUri, 0); reportTimer = new Timer(this.Report, null, TimeSpan.FromSeconds(reportIntervalInSeconds), TimeSpan.FromSeconds(reportIntervalInSeconds)); }
/// <summary> /// Creates a proxy to the actor object that implements an actor interface. /// </summary> /// <typeparam name="TActorInterface"> /// The actor interface implemented by the remote actor object. /// The returned proxy object will implement this interface. /// </typeparam> /// <param name="actorId">Actor Id of the proxy actor object. Methods called on this proxy will result in requests /// being sent to the actor with this id.</param> /// <param name="applicationName"> /// Name of the Service Fabric application that contains the actor service hosting the actor objects. /// This parameter can be null if the client is running as part of that same Service Fabric application. For more information, see Remarks. /// </param> /// <param name="serviceName"> /// Name of the Service Fabric service as configured by <see cref="Microsoft.ServiceFabric.Actors.Runtime.ActorServiceAttribute"/> on the actor implementation. /// By default, the name of the service is derived from the name of the actor interface. However <see cref="Microsoft.ServiceFabric.Actors.Runtime.ActorServiceAttribute"/> /// is required when an actor implements more than one actor interfaces or an actor interface derives from another actor interface as the determination of the /// serviceName cannot be made automatically. /// </param> /// <param name="listenerName"> /// By default an actor service has only one listener for clients to connect to and communicate with. /// However it is possible to configure an actor service with more than one listeners, the listenerName parameter specifies the name of the listener to connect to. /// </param> /// <returns>An actor proxy object that implements <see cref="IActorProxy"/> and TActorInterface.</returns> public TActorInterface CreateActorProxy <TActorInterface>(ActorId actorId, string applicationName = null, string serviceName = null, string listenerName = null) where TActorInterface : IActor { if (string.IsNullOrEmpty(applicationName)) { applicationName = ActorNameFormat.GetCurrentFabricApplicationName(); } var actorInterfaceType = typeof(TActorInterface); var serviceUri = ActorNameFormat.GetFabricServiceUri(actorInterfaceType, applicationName, serviceName); return(this.CreateActorProxy <TActorInterface>(serviceUri, actorId, listenerName)); }
public Task Subscribe(TSubscription subscription) { return(WithLock(async() => { var topicId = subscription.GetTopicId(); if (!_proxies.ContainsKey(topicId)) { var uri = ActorNameFormat.GetFabricServiceUri(typeof(ITopicActor)); var actor = _actorProxyFactory.CreateActorProxy <ITopicActor>(uri, new ActorId(topicId)); await actor.SubscribeAsync(this); _proxies.Add(topicId, actor); } })); }
public async Task Publish(TMessage message, TSubscription subscription) { var uri = ActorNameFormat.GetFabricServiceUri(typeof(ITopicActor)); var topicId = subscription.GetTopicId(); var actor = _actorProxyFactory.CreateActorProxy <ITopicActor>(uri, new ActorId(topicId)); var serialisedMessage = JsonConvert.SerializeObject(message); var serialisedSubscription = JsonConvert.SerializeObject(subscription); await actor.PublishMessage(new TopicActorMessage { Subscription = serialisedSubscription, Message = serialisedMessage }); }