Utilities for working with silos hosted in Windows Fabric.
Exemple #1
0
        /// <summary>
        /// This method causes the communication listener to be opened. Once the Open
        ///             completes, the communication listener becomes usable - accepts and sends messages.
        /// </summary>
        /// <param name="cancellationToken">Cancellation token</param>
        /// <returns>
        /// A <see cref="T:System.Threading.Tasks.Task">Task</see> that represents outstanding operation. The result of the Task is
        ///             the endpoint string.
        /// </returns>
        public async Task <string> OpenAsync(CancellationToken cancellationToken)
        {
            var serviceName = this.parameters.ServiceName;
            var instanceId  = this.parameters.InstanceId;
            var activation  = this.parameters.CodePackageActivationContext;
            var node        = await FabricRuntime.GetNodeContextAsync(TimeSpan.FromMinutes(1), cancellationToken);

            var nodeAddress = await GetNodeAddress(node.IPAddressOrFQDN);

            var siloEndpoint  = new IPEndPoint(nodeAddress, activation.GetEndpoint("OrleansSiloEndpoint").Port);
            var proxyEndpoint = new IPEndPoint(nodeAddress, activation.GetEndpoint("OrleansProxyEndpoint").Port);

            var activeDeploymentId = deploymentId ??
                                     OrleansFabricUtility.GetDeploymentId(serviceName);

            this.fabricSilo = new OrleansFabricSilo(
                serviceName,
                instanceId,
                siloEndpoint,
                proxyEndpoint,
                activeDeploymentId);
            this.MonitorSilo();
            this.fabricSilo.Start(this.configuration);
            return(siloEndpoint.ToString());
        }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OrleansFabricSilo"/> class.
 /// </summary>
 /// <param name="serviceName">
 /// The service name.
 /// </param>
 /// <param name="instanceId">
 /// The instance id.
 /// </param>
 /// <param name="siloEndpoint">
 /// The silo endpoint.
 /// </param>
 /// <param name="proxyEndpoint">
 /// The proxy endpoint.
 /// </param>
 /// <param name="connectionString">
 /// The Azure table service connection string.
 /// </param>
 public OrleansFabricSilo(
     Uri serviceName,
     long instanceId,
     IPEndPoint siloEndpoint,
     IPEndPoint proxyEndpoint)
 {
     this.stopped       = new TaskCompletionSource <int>();
     this.SiloEndpoint  = siloEndpoint;
     this.ProxyEndpoint = proxyEndpoint;
     this.deploymentId  = OrleansFabricUtility.GetDeploymentId(serviceName);
     this.siloName      = this.deploymentId + "_" + instanceId.ToString("X");
 }