Questions tagged [event]

101 questions
42
votes
10 answers

Applicability of Single Responsibility Principle

I recently came by a seemingly trivial architectural problem. I had a simple repository in my code that was called like this (code is in C#): var user = /* create user somehow */; _userRepository.Add(user); /* do some other…
Andre Borges
  • 1,534
  • 1
  • 14
  • 15
29
votes
3 answers

DDD: Where to place domain event handlers?

Could you tell me your opinion that which layer is the right one to place domain event handlers in DDD? For example, I have application service to add a new contract and I'd like to send an email notification to the contact person, when the contract…
Toni
  • 561
  • 1
  • 5
  • 10
22
votes
3 answers

API Gateway (REST) + Event-Driven Microservices

I have a bunch of microservices whose functionality I expose through a REST API according to the API Gateway pattern. As these microservices are Spring Boot applications, I am using Spring AMQP to achieve RPC-style synchronous communication between…
14
votes
2 answers

How to determine if a message should be a command message or event message?

Two enterprise integration patterns are the command message and the event message. I am working on a system in which we use messaging not only for integration with other systems, but for internal communication between services. It's supposed to be…
Kazark
  • 1,810
  • 1
  • 17
  • 37
10
votes
3 answers

Should I reduce event listeners by making functions more complex?

An example would be if you had multiple inputs, each of which effect a completely different process, (perhaps one changes a div's width, while another sends ajax request for predictive search), would you bind a single event use a switch statement to…
user232573
10
votes
2 answers

Should the sender of an event always be a generic Object?

When programming events in C#, it is advised to create a delegate in form of: delegate XEventHandler(object sender, XEventArgs e); My question is on the first argument of the delegate, object sender. Does it always have to be a generic object?…
sampathsris
  • 565
  • 5
  • 17
9
votes
2 answers

Should I use events or abstract methods?

Lets say I create an abstract class that manages some network functionality for me. I want to be able to be notified when something changes. For example: OnConnect or OnDisconnect. Should I create events for those kinds of functions or implement…
Riki
  • 192
  • 1
  • 5
9
votes
2 answers

Should event listeners be held in weak references?

Usually event listeners shouldn't outlive object that registered them. Does it mean that event listeners should be held by weak references by default (stored in weak collections by the object listeners are registered on)? Are there valid cases when…
zduny
  • 2,623
  • 2
  • 19
  • 24
7
votes
3 answers

How do desktop applications get notified of events over the internet?

I would like to display something on my desktop by tapping a button on my mobile app. For example, there is a "show cat" button on my mobile app. When I tap that button, a new window should be opened and display a cat picture on my desktop. The…
LevelRin
  • 81
  • 1
  • 5
7
votes
1 answer

How to represent a loop in Event Storming?

I recently ran an Event Storming session and a scenario came up where we needed to represent a loop within the process. The events and commands needed to happen iteratively until a condition is meant in order for the process to continue to the next…
secondbreakfast
  • 237
  • 1
  • 7
7
votes
2 answers

Testing C# Eventhandler Subscription

I want my unit tests to be able to verify that some events were subscribed or unsubscribed at specific points. Currently, I see two options. VerifiableEventHandler Each client subscribes using the common += and -= notation. Each class that has a…
Wilbert
  • 1,703
  • 1
  • 12
  • 16
7
votes
3 answers

Event-driven vs. 'reference'-driven programming (i.e. in JavaScript)

I haven't been able to find the appropriate terminology to search for content on the web related to what I'm asking, so I'm hoping someone on here can at least point me in the right direction. I'm a fairly senior JavaScript developer, but I have a…
Dan
  • 207
  • 2
  • 3
7
votes
6 answers

Triggering custom events in AJAX callbacks

I'm pretty new to JavaScript, but one of the things that's been frustrating is that our AJAX callbacks have been getting packed with different functionality, making it difficult to keep everything separated and organized. I'm really new to…
6
votes
4 answers

Detect or Prevent Screen Capture Applications

I am building an app that displays very sensitive information and as such, I want to be able to either Disable the ability to capture the screen Redact the portion of my app that is on the screen during capture Detect that a screen capture was…
Ody
  • 187
  • 1
  • 1
  • 8
5
votes
2 answers

Handle failures in Event Driven Architecture

Suppose you have a bounded context with ~30 business events and, for simplicity sake, the same number of commands like ChangeUserEmailCommand -> UserEmailChangedEvent initiated from a web UI. Processing a command may fail for the following main…
1
2 3 4 5 6 7