DelphiFeeds.com

  • Dashboard
  • Popular Stories
  • Trending Stories
  • Feeds
  • Login
Trending now

HeidiSQL Is A Lightweight Open Source Database Management Tool Built In Delphi

Powerful Shipping Container Cargo Optimizer Built In Delphi FireMonkey

Modernizing Your Legacy Delphi Projects

Learn How to Use C++ Bidirectional Fences For Windows Development With C++Builder

Quickly Set Up Flexible Master-Detail Relationships Between Datasets In Delphi Apps

Quickly Create Robust Scalable Delphi Applications With Event Bus Framework

Learn How Easy It Can Be To Update Your C++ Builder Projects With The Embarcadero ...

Learn How Easy It Is To Connect To Microsoft SQL Server In Windows Delphi Development

Secrets Of Delphi: Discover This Obscure Delphi Character Syntax In This Learn Delphi Video

Learn How to Write Your Own Text Driver in This Learn Delphi Video

Learn More About The Powerful Macros Property Of IFDPhysCommand With FireDAC In Delphi

Learn How To Build Decoupled Delphi Applications Quickly With Delphi Event Bus Framework

1
Anbarasan Anbarasan 2 months ago in Code, coderage2019, DeCoupled, Delphi, Delphi Event Bus Framework, object pascal, programming, Publish/Suscribe, Tech Partner 0

Modularity is very important in software architecture so that applications built can be easily extendable and maintainable. Consider your building an application with multiple components in it. If we decide to remove a component and replace it with another component it should not affect the application. This can be done by decoupling software architecture. Do you want to build such decoupled applications in Delphi? This post guide you to build using Delphi Event Bus Framework.

EventBus: An event bus allows publish/subscribe-style communication between components without requiring the components to explicitly be aware of each other. Looks like Observer Pattern? No, there is a difference. In the observer pattern, the broadcast is performed directly from the observable to the observers, so they “know” each other. But when using a publish/subscribe pattern, there is a third component, called event bus, which is known by both the publisher and subscriber. It is Decoupled between Publisher and Subscriber.

Delphi Event Bus allows you to decouple components that asynchronously receive and process events and or emit events. Consumers can subscribe to this event bus and declaratively specify which events they wish to consume. The event consumer a publisher is completely decoupled. Simplifies the communication between components.

Delphi Event Bus Features:

  • Easy and clean: DelphiEventBus is super easy to learn and use because it respects KISS and “Convention over configuration” design principles. By using default TEventBus instance, you can start immediately to delivery and receive events
  • Designed to decouple different parts/layers of your application
  • Event-Driven, Thread Safe, Unit Tested
  • Attributes based API: Simply put the Subscribe attribute on your subscriber method you are able to receive a specific event
  • Support different delivery modes: Specifying the TThreadMode in Subscribe attribute, you can choose to deliver the event in the Main Thread or in a Background one, regardless of where an event was posted. The EventBus will manage Thread synchronization.

How it works :

  • Define Events:
TEvent = class(TObject)
// additional information here
end;
  • Prepare subscribers: Declaring your subscribing method:
[Subscribe]
procedure OnEvent(AEvent: TAnyTypeOfEvent);
begin
  // manage the event 	
end;
  • Prepare subscribers: Register your subscriber:
GlobalEventBus.RegisterSubscriber(self);
  • Post events:
GlobalEventBus.post(LEvent);

Check this below video for Demonstration of How the Delphi Event Bus Framework(DEB) works.

Delphi Event Bus Demonstration

Checkout the full source code for Delphi Event framework here.


Trending Stories

  • HeidiSQL Is A Lightweight Open Source Database Management Tool Built...

  • Powerful Shipping Container Cargo Optimizer Built In Delphi FireMonkey

  • Modernizing Your Legacy Delphi Projects

  • Learn How to Use C++ Bidirectional Fences For Windows Development...

  • Quickly Set Up Flexible Master-Detail Relationships Between Datasets In Delphi...

Embarcadero GetIt

  • Trial - TMS FlexCel for VCL & FMX

    Powerful, extensive and flexible component suite for native Excel report and file generation and […]

  • Trial - TMS Diagram Studio

    Communications package that provides access to the serial ports under Windows. The event-driven […]

  • Trial - TMS FMX UI Pack

    Single-source fully cross platform component set for desktop and mobile application development for […]

  • Trial - TMS FMX Cloud Pack

    TMS FMX Cloud Pack is a Delphi and C++Builder component library to seamlessly use all major cloud […]

  • Trial - TMS FNC Blox

    TMS FNC Blox offers cross-platform & cross-framework diagramming/flowcharting components for […]

  • Learn Delphi
  • Learn C++
  • Embarcadero Blogs
  • BeginEnd.net
  • Python GUI
  • Firebird News
  • Torry’s Delphi Pages
Copyright DelphiFeeds.com 2021. All Rights Reserved
Embarcadero
Login Register

Login

Lost Password

Register

Lost Password