Kategorie

Event Consumer (Plugin)

1 Introduction

This document is a guide for developers to the Event Consumer of GrandNode.

Event Consumer allows to attach your own code to many Events placed in application.

2 Fast Startup

In many places is application you can see this code, that uses EventPublisher object and calls its Publish()

step1

You can look at all existing Events here by references (Grand.Services.Events.EventPublisher.Publish)

step2

So let’s say we choose CustomerLoggedInEvent for our Event.
This Event is raised after any user log in application. 

All you need is to add one class

step3

With this basic content

step4

Example what you can put in HandleEvent(). Raised Event usually should be redirected to Plugin’s ComputationMethod and its Method.

step5

3 Further Explaination

Once Event is raised, Publish collects all referenced by interface types, and then, calls PublishToConsumer()

step6

PublishToConsumer() calls HandleEvent() Method and passes argument with value that was passed to _eventPublisher.Publish()

step7

back to top