Exemple #1
0
        public async Task <string> CancelOrderAsync(string reason)
        {
            // This line creates a [SignalRequest] instance that somewhat
            // magically initializes the [SignalRequest.Args] dictionary
            // with the names and values of the parameters passed to this
            // method.
            //
            // Note that the <string> generic parameter here specifies the
            // result type for this signal method.

            var signalRequest = new SignalRequest <string>();

            // Enqueue the signal request such that workflow method above
            // can process it as part of the workflow logic.

            await queue.EnqueueAsync(signalRequest);

            // Throwing this exception indicates to the Temporal client
            // that the signal result will be sent as a reply from
            // the workflow code via the [SignalRequest] rather than
            // via a result returned by this signal method.
            //
            // We understand that this is a bit odd, but this is an
            // experimental feature after all.  The Temporal team is
            // working on a new feature to handle these scenarios
            // cleanly.

            throw new WaitForSignalReplyException();
        }
Exemple #2
0
        public async Task <bool> CancelAsync()
        {
            // We're going to enqueue a signal request to marshal it
            // into the workflow logic which will dequeue it.
            //
            // The [SignalRequest] constructor here is a bit magical.
            // The generic parameter specifies the result type that
            // will be returned by the workflow logic.  This is often
            // the same as the signal methods return type, but it
            // doesn't have to be the same.
            //
            // The magic part is that the request constructor automatically
            // initializes its [Args] dictionary with the names and values
            // of any arguments passed to this method.  In this example,
            // there are no parameters but if there were any, they would
            // have been added to the request so they'd be available for
            // the workflow logic.

            await cancelQueue.EnqueueAsync(new SignalRequest <bool>());

            // Throwing this exception indicates to the Cadence client
            // that the signal result will be sent as a reply from
            // the workflow code via the [SignalRequest] rather than
            // via a result returned by this signal method.
            //
            // We understand that this is a bit odd, but this is an
            // experimental feature after all.  The Cadence team is
            // working on a new feature to handle these scenarios
            // cleanly.

            throw new WaitForSignalReplyException();
        }
Exemple #3
0
            public async Task <string> SignalResultAsync(string name)
            {
                var signalRequest = new SignalRequest <string>();

                await resultQueue.EnqueueAsync(signalRequest);

                throw new WaitForSignalReplyException();
            }
Exemple #4
0
            public async Task SignalVoidAsync(string name)
            {
                var signalRequest = new SignalRequest();

                await voidQueue.EnqueueAsync(signalRequest);

                throw new WaitForSignalReplyException();
            }
Exemple #5
0
 public async Task SignalNameAsync(string name)
 {
     await signalQueue.EnqueueAsync(name);
 }
Exemple #6
0
 public async Task SignalAsync(string message)
 {
     await signalQueue.EnqueueAsync(message);
 }
Exemple #7
0
            public async Task <string> SignalAsync(string name)
            {
                await signalQueue.EnqueueAsync(new SignalRequest <string>());

                throw new WaitForSignalReplyException();
            }