private IActorRemotingMessageHeaders CreateActorHeader(ActorRemotingDispatchHeaders actorDispatchHeaders) { InterfaceDetails details; if (ActorCodeBuilder.TryGetKnownTypes(actorDispatchHeaders.ActorInterfaceName, out details)) { var headers = new ActorRemotingMessageHeaders(); headers.ActorId = actorDispatchHeaders.ActorId; headers.InterfaceId = details.Id; if (String.IsNullOrEmpty(actorDispatchHeaders.CallContext)) { headers.CallContext = Helper.GetCallContext(); } else { headers.CallContext = actorDispatchHeaders.CallContext; } var headersMethodId = 0; if (!details.MethodNames.TryGetValue(actorDispatchHeaders.MethodName, out headersMethodId)) { throw new NotSupportedException("This Actor Method is not Supported" + actorDispatchHeaders.MethodName); } headers.MethodId = headersMethodId; return(headers); } throw new NotSupportedException("This Actor Interface is not Supported" + actorDispatchHeaders.ActorInterfaceName); }
internal Task SubscribeAsync(int eventInterfaceId, Guid subscriberId) { var actorRemotingMessageHeaders = new ActorRemotingMessageHeaders { ActorId = this.ActorId, InterfaceId = ActorEventSubscription.InterfaceId, MethodId = ActorEventSubscription.SubscribeMethodId, }; actorRemotingMessageHeaders.InterfaceId = ActorEventSubscription.InterfaceId; actorRemotingMessageHeaders.MethodId = ActorEventSubscription.SubscribeMethodId; var msgBody = new ServiceRemotingRequestMessageBody(1); msgBody.SetParameter(0, "Value", new EventSubscriptionRequestBody() { eventInterfaceId = eventInterfaceId, subscriptionId = subscriberId }); return(this.InvokeWithRetryAsync( client => client.RequestResponseAsync( new ServiceRemotingRequestMessage(actorRemotingMessageHeaders, msgBody)), CancellationToken.None)); }
public void RaiseEvent(int eventInterfaceId, int methodId, IServiceRemotingRequestMessageBody eventMsgBody) { var headers = new ActorRemotingMessageHeaders { ActorId = new ActorId(this.id), InterfaceId = eventInterfaceId, MethodId = methodId }; this.callbackV2.SendOneWay( new ServiceRemotingRequestMessage(headers, eventMsgBody)); }
internal override Task <IServiceRemotingResponseMessage> InvokeAsyncImplV2( int interfaceId, int methodId, IServiceRemotingRequestMessageBody requestMsgBodyValue, CancellationToken cancellationToken) { var headers = new ActorRemotingMessageHeaders { ActorId = this.servicePartitionClientV2.ActorId, InterfaceId = interfaceId, MethodId = methodId, CallContext = Helper.GetCallContext() }; return(this.servicePartitionClientV2.InvokeAsync(new ServiceRemotingRequestMessage(headers, requestMsgBodyValue), cancellationToken)); }