How is your experience with the OutSystems Community?
22
Views
6
Comments
adding a handler to an event in ODC Studio
Application Type
Traditional Web

Hi Everybody,

I am a newbie and I am training on ODC attending to ODC architect course.
There is a chapter of this course where it explain ho to define, trigger and handle an event.
It is a kind of pub/sub pattern with a single producer but many consumer.

Well I have defined an event  (myFirstEvent)

I have create a trigger and 2 handlers

but  I can add obly one handler in the definition (as you can sse in the first image)

I don't find an action to add the second handler in the event definition, where am I wrong??

I'm expecting an action that will allow me to add a new handler in the event definition or relate the handler to an event. 

I am using this ODC Studio version

UserImage.jpg
Giovanni Peirone

I guess I had understood the question.

I guess every app cam have only on handler for the event, I you need more consumer you must define new apps.

Isn't it?


2021-09-06 15-09-53
Dorine Boudry
 
MVP

that's it.

The handler is just the piece of logic in any given application that gets executed on the event.

There is no need to have more than 1 handler in a single app.  If you want 2 completely different things in the same application to happen BOTH as reaction to a single event, there is nothing stopping you from executing them BOTH from that handler, you don't need 2 handlers for that.

UserImage.jpg
Giovanni Peirone

I have another question yet.

I an pub/sub pattern i can have many producer as many consumer. 

In ODC, is it possibile to have many producer app when the event is defined only in one app?
I guess the pattern is one producer / many producer. Is it right?

G.


2021-09-06 15-09-53
Dorine Boudry
 
MVP


Unfortunately, the way it is designed, only allows you to raise the event in the application that owns/defines it.  But there is nothing stopping you from wrapping a raise in a service action and use that from many other applications.

2026-05-21 04-48-12
Deepa Tiwari

Hi @Giovanni Peirone ,

In ODC, a single Event can have only one Handler within an application. This is the expected behavior.

If you need different processing logic, you have a couple of options:

  • Create multiple Events, each with its own Handler, if they represent different business scenarios.
  • Use a single Event and include a parameter (for example, a Type or Action field). Inside the Handler, use an If or Switch to route the execution to different Server Actions based on the parameter value.

This approach keeps the event model simple while still allowing multiple processing paths through separate actions invoked by the Handler.
Hope this will help you.

Regards
Deepa

2025-04-10 11-25-12
Diogo Reis

Hi.

You can wrap those 2 action in 1 and set that new action as the Event handler.

If you have more questions, please let me know.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.