Exemple #1
0
        private void SessionManagerConstructorHelper(
            Guid partitionId,
            long replicaId,
            Uri ownerServiceInstanceName,
            NativeTypes.FABRIC_PARTITION_KEY_TYPE keyType,
            object partitionKey)
        {
            // AppTrace.TraceSource.WriteNoise("ReliableMessaging.NativeReliableMessaging.FabricCreateReliableSession");

            // Marshal the serviceInstance URI
            // TODO: Call FreeHGlobal when done with this native string

            partitionKey = PartitionKeyHelpers.NormalizeManagerPartitionKey(partitionKey);

            using (var pin = new PinCollection())
            {
                this.nativeSessionManager = NativeReliableMessaging.CreateReliableSessionManager(
                    pin.AddBlittable(HostServicePartitionInfoFactory.ToNativeValue(partitionId, replicaId)),
                    pin.AddObject(ownerServiceInstanceName),
                    keyType,
                    pin.AddBlittable(partitionKey)
                    );
            }

            Debug.Assert(null != this.nativeSessionManager);
        }
Exemple #2
0
        private NativeCommon.IFabricAsyncOperationContext CreateOutboundSessionAsyncBeginWrapper(
            Uri ownerServiceInstanceName,
            NativeTypes.FABRIC_PARTITION_KEY_TYPE keyType,
            object partitionKey,
            string targetEndpoint,
            NativeCommon.IFabricAsyncOperationCallback callback)
        {
            // AppTrace.TraceSource.WriteNoise("ReliableMessaging.NativeReliableMessaging.FabricCreateReliableSession");

            partitionKey = PartitionKeyHelpers.NormalizeManagerPartitionKey(partitionKey);

            using (var pin = new PinCollection())
            {
                return(this.nativeSessionManager.BeginCreateOutboundSession(
                           pin.AddObject(ownerServiceInstanceName),
                           keyType,
                           pin.AddBlittable(partitionKey),
                           pin.AddBlittable(targetEndpoint),
                           callback));
            }
        }