# How to deal with signals dynamically in go

**URL:** <https://community.temporal.io/t/how-to-deal-with-signals-dynamically-in-go/9249>\
**Category:** Community Support\
**Tags:** go-sdk, general-impl\
**Created:** [August 19, 2023, 10:33am UTC](https://community.temporal.io/t/how-to-deal-with-signals-dynamically-in-go/9249 "2023-08-19T10:33:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sumitsinghjadaun](https://avatars.discourse-cdn.com/v4/letter/s/6a8cbe/32.png) [@sumitsinghjadaun](https://community.temporal.io/u/sumitsinghjadaun)\
**Post date:** [August 19, 2023, 10:33am UTC](https://community.temporal.io/t/how-to-deal-with-signals-dynamically-in-go/9249/1 "2023-08-19T10:33:02Z")

</div>

Hi,  
I have to deal with multiple signals in golang temporal workflow where signal sending party is a java workflow. I could see that with the help of workflow.GetSignalChannel(ctx, “MySignal”) we can create a signalChannel but that will listen to a particular signal with name “MYSignal”. So I want to handle it dynamically where the signal sending party can send signal Mysignal1 or Mysignal2. I don’t want to use 2 separate channels using GetSignalChannel instead I want to create a chanel var where it will listen to a signal and then with the help of switch case we can compare whether it is a Mysignal1 or Mysignal2 we can take a decision.  
How to achieve that in golang. I could see that in java we  
could do it with DynamicSignalHandler as shown below.  
Workflow.registerListener((DynamicSignalHandler) (signalName, encodedArgs)  
Also when I will implement it like:  
workflow.GetSignalChannel(ctx, “MySignal1”)  
workflow.GetSignalChannel(ctx, “MySignal2”)  
then it will be a blocking call here then I may loose the other signal.  
also How can I make it a continuous workflow which will keep on running and listening to signals forever until an exception occurs  
Any pointer to the example would be helpful

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [August 20, 2023, 4:08pm UTC](https://community.temporal.io/t/how-to-deal-with-signals-dynamically-in-go/9249/2 "2023-08-20T16:08:55Z")

</div>

In Go you would get two signal channels and listen to both using [Selector](https://docs.temporal.io/dev-guide/go/features#using-selectors-with-channels).

This is similar to using `select` statement to listen on two native Go channels.

---

<div class="post-metadata">

**Author:** ![sumitsinghjadaun](https://avatars.discourse-cdn.com/v4/letter/s/6a8cbe/32.png) [@sumitsinghjadaun](https://community.temporal.io/u/sumitsinghjadaun)\
**Post date:** [August 21, 2023, 10:46am UTC](https://community.temporal.io/t/how-to-deal-with-signals-dynamically-in-go/9249/3 "2023-08-21T10:46:33Z")

</div>

It would be great if you could share an example which continuously (in some continuous loop with some sleep) listens to 2 different signals

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [August 21, 2023, 11:06am UTC](https://community.temporal.io/t/how-to-deal-with-signals-dynamically-in-go/9249/4 "2023-08-21T11:06:58Z")

</div>

I think the pattern demonstrated in [await-signals sample](https://github.com/temporalio/samples-go/tree/main/await-signals) is more applicable to your use case.

---

<div class="post-metadata">

**Author:** ![sumitsinghjadaun](https://avatars.discourse-cdn.com/v4/letter/s/6a8cbe/32.png) [@sumitsinghjadaun](https://community.temporal.io/u/sumitsinghjadaun)\
**Post date:** [August 22, 2023, 8:31am UTC](https://community.temporal.io/t/how-to-deal-with-signals-dynamically-in-go/9249/5 "2023-08-22T08:31:29Z")

</div>

The example here deals with the internal workflow , while I am looking for an example where we can send signal from one temopral go workflow and receiving signal on other go workflow so kind of dealing with externalworkflows external signals in go.  
Also in the example for await-signals [await-signals](https://github.com/temporalio/samples-go/tree/main/await-signals) is the call selector.Select(ctx) a blocking call ie. until we receive signal in signal1 or signal2 or signal3 till then will it wait for signal to receive like select case in pure go channel cases.  
If I have to block a workflow such that it should not exit until a cancel request is trigger from the UI and keep on listening in some loop with some predefined delay or sleep than how that can be dealt with
