Event Driven Architecture with Custom Event Trigger and Advanced Filtering

Published Aug 17 2021 09:18 PM 3,044 Views

Event-driven architecture (EDA) is a common data integration pattern that involves production, detection, consumption, and reaction to events. Data integration scenarios often require Azure Data Factory customers to trigger ETL or ELT pipelines when certain events occur.

 

Azure Data Factory native integration with Azure Event Grid now covers custom topics: the application and third-party topics. Custom topic, created by the event publisher, provides an endpoint where source sends events. Azure Data Factory subscribes to the topic and triggers a pipeline in response to incoming events.

 

Additionally, Azure Data Factory now supports Advanced Filtering that gives users fine grain control over which events to respond to based on the values in the event payload. For instance, you can express logic such as, a ETL pipeline should run if and only if data.date field in list [1, 2, 3, 4, 5], data.month field not in list [11, 12], data.tag field contains any of ['Fiscal Year 2021', 'FiscalYear2021', 'FY2021'].

custom-event-5-advanced-filters.png

 

 

You can also implement Metadata Driven + Event Driven architecture, by passing event payload values to pipeline parameters, using prefix @triggerBody().event.data.<key_name>, and consumes these values in your pipeline definition. For information, please refer to Retrieve and Reference Trigger Metadata in Pipeline.

 

custom-event-3-parameters.png

To create a Custom Event Trigger, event producer needs to define a custom topic in Event Grid (see Azure Event Grid Custom Event Topic tutorials). And by creating a Custom Event Trigger, Azure Data Factory will create a subscription against the aforementioned topic.

 

Click + New Trigger, specify the Event Grid Topic Name, Subject Begins WithSubject Ends With, and Event Types

custom-event-2-properties.png

 

Once published and activated, you can double check successful creation by browsing to the aforementioned event topic in Azure Portal and see a new subscription created by Azure Data Factory.

1 Comment
%3CLINGO-SUB%20id%3D%22lingo-sub-2658682%22%20slang%3D%22en-US%22%3EEvent%20Driven%20Architecture%20with%20Custom%20Event%20Trigger%20and%20Advanced%20Filtering%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2658682%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3EEvent-driven%20architecture%20(EDA)%20is%20a%20common%20data%20integration%20pattern%20that%20involves%20production%2C%20detection%2C%20consumption%2C%20and%20reaction%20to%20events.%20Data%20integration%20scenarios%20often%20require%20Azure%20Data%20Factory%20customers%20to%20trigger%20ETL%20or%20ELT%20pipelines%20when%20certain%20events%20occur.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EAzure%20Data%20Factory%20native%20integration%20with%20%3CA%20title%3D%22https%3A%2F%2Fazure.microsoft.com%2Fservices%2Fevent-grid%2F%22%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fservices%2Fevent-grid%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%20data-href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fservices%2Fevent-grid%2F%22%3EAzure%20Event%20Grid%3C%2FA%3E%26nbsp%3Bnow%20covers%26nbsp%3B%3CA%20title%3D%22Custom%20Topics%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fevent-grid%2Fcustom-topics%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%20data-href%3D%22..%2Fevent-grid%2Fcustom-topics.md%22%3Ecustom%20topics%3C%2FA%3E%3A%20the%26nbsp%3Bapplication%20and%20third-party%20topics.%26nbsp%3BCustom%20topic%2C%20created%20by%20the%20event%20publisher%2C%20provides%20an%20endpoint%20where%20source%20sends%20events.%20Azure%20Data%20Factory%20%3CSTRONG%3Esubscribes%3C%2FSTRONG%3E%20to%20the%20topic%20and%20triggers%20a%20pipeline%20in%20response%20to%20incoming%20events.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EAdditionally%2C%20Azure%20Data%20Factory%20now%20supports%20%3CA%20title%3D%22Advanced%20Filtering%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fevent-grid%2Fevent-filtering%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAdvanced%20Filtering%3C%2FA%3E%26nbsp%3Bthat%20gives%20users%20fine%20grain%20control%20over%20which%20events%20to%20respond%20to%20based%20on%20the%20values%20in%20the%20event%20payload.%20For%20instance%2C%20you%20can%20express%20logic%20such%20as%2C%20a%20ETL%20pipeline%20should%20run%20if%20and%20only%20if%20%3CEM%3Edata.%3C%2FEM%3E%3CEM%3Edate%3C%2FEM%3E%26nbsp%3Bfield%20in%20list%20%5B1%2C%202%2C%203%2C%204%2C%205%5D%2C%26nbsp%3B%3CEM%3Edata.m%3C%2FEM%3E%3CEM%3Eonth%3C%2FEM%3E%26nbsp%3Bfield%26nbsp%3B%3CSTRONG%3Enot%3C%2FSTRONG%3E%26nbsp%3Bin%20list%20%5B11%2C%2012%5D%2C%26nbsp%3B%3CEM%3Edata.t%3C%2FEM%3E%3CEM%3Eag%3C%2FEM%3E%26nbsp%3Bfield%20contains%20any%20of%20%5B'Fiscal%20Year%202021'%2C%20'FiscalYear2021'%2C%20'FY2021'%5D.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22custom-event-5-advanced-filters.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F303942iC20C6852369D9A99%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22custom-event-5-advanced-filters.png%22%20alt%3D%22custom-event-5-advanced-filters.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20also%20implement%20Metadata%20Driven%20%2B%20Event%20Driven%20architecture%2C%20by%20passing%20event%20payload%20values%20to%20pipeline%20parameters%2C%20using%20prefix%20%40triggerBody().event.data.%26lt%3B%3CEM%3Ekey_name%3C%2FEM%3E%26gt%3B%2C%20and%20consumes%20these%20values%20in%20your%20pipeline%20definition.%20For%20information%2C%20please%20refer%20to%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fazure-data-factory%2Fretrieve-and-reference-trigger-metadata-in-pipeline%2Fba-p%2F2180793%22%20target%3D%22_blank%22%3ERetrieve%20and%20Reference%20Trigger%20Metadata%20in%20Pipeline%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22custom-event-3-parameters.png%22%20style%3D%22width%3A%20591px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F303943i056E77B702027408%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22custom-event-3-parameters.png%22%20alt%3D%22custom-event-3-parameters.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3ETo%20create%20a%20Custom%20Event%20Trigger%2C%20event%20producer%20needs%20to%20define%20a%20custom%20topic%20in%20Event%20Grid%20(%3CSPAN%3Esee%20%3CA%20title%3D%22Azure%20Event%20Grid%26nbsp%3BCustom%20Event%20Topic%20tutorials%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fazure%2Fevent-grid%2Fcustom-topics%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Event%20Grid%26nbsp%3BCustom%20Event%20Topic%20tutorials%3C%2FA%3E).%20And%20by%20creating%20a%20Custom%20Event%20Trigger%2C%20Azure%20Data%20Factory%20will%20create%20a%20subscription%20against%20the%20aforementioned%20topic.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EClick%20%2B%20New%20Trigger%2C%20specify%20the%20%3CEM%3EEvent%20Grid%20Topic%20Name%3C%2FEM%3E%2C%20%3CEM%3ESubject%20Begins%20With%3C%2FEM%3E%2C%26nbsp%3B%3CEM%3ESubject%20Ends%20With%2C%26nbsp%3B%3C%2FEM%3Eand%20%3CEM%3EEvent%20Types%3C%2FEM%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CEM%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22custom-event-2-properties.png%22%20style%3D%22width%3A%20236px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F303944i5965923153F04A31%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22custom-event-2-properties.png%22%20alt%3D%22custom-event-2-properties.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FEM%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CEM%3E%3C%2FEM%3EOnce%20published%20and%20%3CSTRONG%3E%3CEM%3Eactivated%3C%2FEM%3E%3C%2FSTRONG%3E%2C%20you%20can%20double%20check%20successful%20creation%20by%20browsing%20to%20the%20aforementioned%20event%20topic%20in%26nbsp%3B%3CSTRONG%3EAzure%20Portal%26nbsp%3B%3C%2FSTRONG%3Eand%20see%20a%20new%20subscription%20created%20by%20Azure%20Data%20Factory.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-2658682%22%20slang%3D%22en-US%22%3E%3CP%3EImplement%20Event%20Driven%20Architecture%20(EDA)%20and%20run%20pipelines%20in%20response%20to%20incoming%20events%20posted%20to%20Event%20Grid.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2658682%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Data%20Factory%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Eevent%20driven%20architecture%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Emetadata%20driven%20architecture%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Etrigger%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2658714%22%20slang%3D%22en-US%22%3ERe%3A%20Event%20Driven%20Architecture%20with%20Custom%20Event%20Trigger%20and%20Advanced%20Filtering%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2658714%22%20slang%3D%22en-US%22%3E%3CP%3ELinks%20to%20official%20documentation%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fdata-factory%2Fhow-to-create-custom-event-trigger%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fdata-factory%2Fhow-to-create-custom-event-trigger%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Co-Authors
Version history
Last update:
‎Aug 17 2021 09:18 PM
Updated by: