Triggering a Workflow using Event Listeners in AEM


AEM Version: 6.2
Target Audience: AEM Developers


In AEM 6.2 Workflows, we can trigger a workflow when a DAM Asset is created, modified, or deleted within a given path. In this article, we will explore triggering workflows from our code based on events in the JCR.

Suppose you have a workflow that creates custom renditions of assets in addition to the default AEM renditions, when the asset is under “/content/dam/ProjectName/images/”. You would have set up two launchers for triggering this workflow: one with event type as “Node Create” and one with “Node Modified”. We can also achieve the same functionality through our code, without touching the GUI.


When assets are moved into a certain folder structure in DAM, trigger a workflow that creates a 100px X 100px thumbnail of our image.


Fig 1: Before Moving the asset, no custom thumbnail. Fig 2: Desired result after moving the asset, the new thumbnail.


The intuitive thought is that when an asset is moved, a new node is created in the new location and the old one is deleted. However, experience shows that AEM does not create a new node in the destination folder on Node Move. We know this because the ‘jcr:Created’ property does not change. AEM does not even change the last modified date.

Creation Timestamp Before Moving the Asset Creation Timestamp is the same after moving

Fig 3: Creation Timestamp Before Moving the Asset. Fig 4: Creation Timestamp is the same after moving

Modification Timestamp Before Moving the Asset. Modification Timestamp is the same after moving

Fig 5: Modification Timestamp Before Moving the Asset. Fig 6: Modification Timestamp is the same after moving.

What if we copy the asset?

On copying the asset, a new version of the same is created. This triggers the Node Creation launcher.

No versions before copying the asset Version created after copy-pasting the asset

Fig. 7: No versions before copying the asset. Fig. 8: Version created after copy-pasting the asset.


Event Listeners

AEM supports observation, which enables us to receive notifications of persistent changes to the workspace. A persisted change to the workspace is represented by a set of one or more events. Each event reports a single simple change to the structure of the persistent workspace in terms of an item added, changed, moved or removed. There are thus 7 possible events at the JCR level, viz:

  1. Node Added
  2. Node Moved
  3. Node Modified
  4. Node Removed
  5. Property Added
  6. Property Removed
  7. Property Changed

We connect with the observation mechanism by registering an event listener with the workspace. An event listener is a class implementing the EventListener interface, that responds to the stream of events to which it has been subscribed. An event listener is added to a workspace with:

(A detailed explanation of each parameter is given with the code example in the package as well as the at the end of this article) As defined by the EventListener interface, listener must provide an implementation of the onEvent method:

When an event occurs that falls within the scope of the listener, the repository calls the onEvent method invoking our logic which processes/responds to the event. In our case, we will register an event listener to listen for “Node Moved” events under “/content/dam/images” so that when an asset is moved to that folder, our workflow can be triggered.


When the component is activated, the activate(…) method is called. It contains a call to ObservationManager.addEventListener(…) for registering the event listener. The deactivate(…) method contains logic for deregistering the event listener, and is triggered when the bundle is being stopped.

When the relevant event occurs, the onEvent(…) method is called, which contains logic for processing the event. In our case, we trigger a workflow.

The following is the relevant code from

Download this code (including the workflow):

Build it using

N.B: Creating a workflow is not part of this tutorial, and therefore a ready workflow has been provided in the code package. However, if you want to learn to create workflows, here is an excellent resource: ->



Adobe Consulting Services. (2018, March 20). acs-aem-samples/ at master · Adobe-Consulting-Services/acs-aem-samples. Retrieved from Github:

Day Software AG. (2018, March 20). JCR 2.0: 12 Observation (Content Repository for Java Technology API v2.0). Retrieved from Adobe Docs:

Adobe Marketing Cloud


Marketing professionals have to speak the language of their customers. In order to reach them, they have to deliver right content through right channels to the right devices and provide a personalised experience. To achieve this, they need to quantify the facts with huge data.

Online presence must be consistent across devices channels and languages to ensure a personalised experience. They also need to efficiently manage and measure their social marketing activities and optimize their marketing expend on certain display.

So is there a solution that can address these challenges??

Fortunately, there is… The Adobe Marketing Cloud

Leveraging 8 solutions offered by Adobe marketing cloud, one can comfortably master this digital marketing solution.

Let’s elaborate these solutions one by one…

Experience Manager 

It’s quiet difficult to understand demands and to meet out the expectations of every single customer, they are expecting companies to provide the relevant content on all the devices they have been using and they are actually switching from one of these digital devices to another. So they may be shopping on website, looking on things on mobile app and when they go into store they want all of that digital experiences to connect together.

So it’s important for brands to think about how to deliver that consistent continuous experience across all these devices.

Marketers has to manage several websites that’s quite a challenge because website should be adaptive to multiple devices and languages.

The content is inconsistent because assets aren’t organised. Also it is difficult to properly optimise websites all tie in social media which makes content less relevant to customer’s web experience.

That’s where Adobe experience Manager comes in.

Adobe experience manager helps marketer get everything under control. The Adobe solution provides a web content management system featuring a multilingual what you see is what you get mode, so it becomes very easy to manage all the website apps and digital publications.

 AEM has 5 components to it

  1. Sites
  2. Assets
  3. Apps
  4. Forms
  5. Communities

 Each of these are critical to brand journey and building out a comprehensive digital strategy.


People visiting your site have different intentions, some are there to buy stuff, others simply doing research, and some might be trying to get a job with you. Then you got your first time visitors, and returning ones. Some don’t know why they’re there and are looking for a way out.

Despite of this, most websites and landing pages display exactly the same content for all visitors – no matter what they’re searching for or how they got there in the first place. These websites try to appeal to a wide range of visitors simultaneously, and thus are not exciting many.

Wouldn’t it be awesome to display different content and call-to-actions for different types of visitors? Essentially making your visitors feel like that the page speaks their language?
Well there is a grounded leading solution named as ADOBE ANALYTICS 

that provides digital marketers with one place to measure, analyze, and optimize integrated data from all online initiatives across multiple marketing channels. 

It provides marketers with actionable, real-time web analytics intelligence about digital strategies and marketing initiatives.

It works by looking at the data which is provided by analytics about the visitor – things like location, keywords they searched for, ads they clicked in, whether they’ve been to the site before and also things like buying history – and compares that against a set of variables that you have put in place. It lets you target relevant content to different types or groups of visitors based on their behavior or other variables.

Those variables could include:

  • Location – city, country, region
  • Device – iPhone, iPad, Android phone/tablet, Windows, Mac, Linux
  • Search keywords 
  • Visitor frequency – First, second, third, fifth time visitor?
  • Date and time of day, proximity to payday
  • Referring URL – where did they come from?
  • Customer history – have bought before, what, how much did it cost?
  • Sessions behaviour – navigation clicks, page views

There are many more variables which can be taken into account like age, gender etc. – possibilities are pretty much endless and it depends a lot on how much info you have about that customer already.


In this competitive era of digital marketing, every visitor on the website can never be a customer. Every marketing professional wants to communicate well with their visitors by extracting their needs and personalised interest. Every customer expects a unique experience and personalised offers rather than a one side communication by a website. In order to fulfil those expectations, a marketer requires an effective plan to get an optimum amount of marketing expenditure so as to avail a limited number of offers on stuff

Adobe target analyses customer wishes and demands by the data provided by adobe analytics helps to deliver relevant content and tightly integrates with adobe social for enhanced social marketing. Now one can deliver right products to the right targeted customers. This kind of automated behavioural targeting imparts an exponential growth in number of customers

Also it helps to dynamically create content based on the visitor’s profile and to suggest targeted recommendations to the user even before he finishes typing their search queries. External data sources like order history can also be integrated to analyse visitors profile which further helps in optimised merchandising and discount on the targeted stuff. This dynamic navigation guarantees a perfect on site experience 


It is very important to reach out your customers in meaning full ways.

With Adobe campaign you are able to integrate and deliver one to one campaign so all the customers get relevant and consistence experience across online and offline channels.

We come to understand each customer through integrated profile which is made up of the purchasing history social interaction, where they are from and other information gathered by analytics pull into adobe campaign

Adobe campaign use this analytics data to create personalised campaigns according to the customers interest.

Reports in adobe campaign show you how things are going, you can see who is responding to your offers, how much revenue your campaigns is generating.

With adobe campaign you have a deep real time understanding of your customers so you can design, integrate and automate cross channel experiences and measure the success. All for one solution


Social media manager are responsible for increasing brand reach and audience engagement through social and creating a consistent brand experience across channels and devices

They must also ensure the right message gets through all the noise of social traffic to the right customers and you need to respond to customer issues that arise via social platforms. And you need to connect all these social efforts to measurable business results

How one possibly monitor manage and measure so many social media channels and also quantify the business value of social marketing.

Easy. All we need is Adobe Social

Adobe social enables marketers to scale social across the organisation; create and deliver relevant, engaging content across all social properties; capture and analyse all key sources of meaningful social data alongside integrated conversion metrics; leverage data to demonstrate social value and optimise interactions; and manage and strengthen customer relationships across social channels – All from one integrated platform

Audience Manager

What problem are we trying to solve with Audience Manager?

Marketers had multiple database and technologies that they use to solve personalisation across each channels.

There are lot of technologies, customers can be on web, mobile, email or social. The challenge here is database is touching into multiple channels. Marketer here really dint have a coherent or a relevant conversation as a consumer moves across multiple touchpoint. And this is the reason for disjoint experience. 

And this something which can be address by DMP

A data management platform or Audience Manager consolidate audience information from all available sources. It identifies, quantified and optimises high value target audiences which can then be offered to advertisers via an integrated, secure, privacy-friendly management system that works across all advertising distribution platforms

 DMP consist 4 key part

  1. Collect data – Collect data and allows that to sit in single repository.
  2. Unify Data to a profile – DMP can take this data from the different sources and unify that data back to a profile
  3. Create Audiences – In DMP, you can take the various profile information that you have to create audiences and audience segments.
  4. Push to Marketing platforms: Value you creating this segments is the capability to reach the people who follow the segments
Adobe Media Optimiser

Once building a great website is done, it is time think about MONEY

Marketers really need to get a larger return on their ad spend to engage more relevant audiences derive brand awareness and generate revenue.

But how one should distribute their media budget between display, search and social

What is the most profitable way to run across channel advertising campaign.

Advertisers are trying to simplify their lives, they are trying to have more control to right campaigns and their budgets and trying to be more efficient with their ad buys.

With Adobe Media optimiser we can answer all these questions easily and get maximum return on our investments.

Using mathematical models and industry leading algorithm adobe media optimiser preciously evaluates the situation which enables us to adjust our strategies, goals and budget in real time

It also provides precise forecast based on our goals and predicts the best channels mix for his budget

With adobe optimiser marketers can manages all of his campaigns for every platform.

Search engine like google & Bing. Social platforms like Facebook and Twitter

So Marketers can always rely on peak conversions and the right investments

The right messages to right people at the right time

so finally not only traffic on website will increase but the revenue will also grow profitably


The way people watch TV and video has evolved. 

You need to personalize it.

Users want to jump in and only experience they want to be fully immersed. This means making it easy for each viewer to have the TV shows and sports and films they want, streaming securely and high definition across different screen wherever and whenever

Adobe primetime part of adobe marketing cloud helps delivering helps delivering engaging experiences for viewers and subscribers and more revenue from advertising and subscription

Now its possible to create engaging experiences on every device using primetime 

Primetime allows you to deliver the right ads to right audience to improve the effectiveness of your ad sells


We all know key to mastering customer experience is knowing the customer and for this Adobe Marketing cloud is perfect fit. My vote goes for Adobe Marketing cloud.

What about you????

Credits: Adobe Sites 

Magical Marketing Mechanism


You are munching your most loved hot hot crispy samosa, while checking your emails on mobile, you receive an email from your favorite e-commerce site and you spot your chosen “jeans” which you have been looking for some time now, is available at a steep discount. You were following that “jeans” on web and social for quite some time and always wished you get some discount on it. You had seen ads of it in your social networking and media sites and were always thought of buying it. You had in fact added it into your shopping cart but always felt it to be expensive.

You click the link in the email and see some nice photos of it and also some more suggestions based on your interest and find more attractive options.

You call you friend and tell the same but your friend has not received any such email or see any reduction in price or discounts on the site.

You are provoked more to buy it immediately as you do not want to lose the opportunity and don’t want to risk the out of stock scenario.

You go ahead get you credit card and buy it immediately. WOW, that’s the feeling you get and you are excited about your purchase for the next party you are going to have over the weekend. You feel thankful to the e-commerce site to give, only you the discounted price and feel great about your quick decision to purchase. You quickly share and tweet about your purchase and your friends are liking it.


  • How your favorite e-commerce site knew you were looking for “jeans” from quite some time now?
  • How could only you could get the email and the discounts?
  • How could you see more suggestions and options which you had tried searching but could not get?
Adobe Marketing Cloud is one such solutions which is the answer for above questions.

Lets suppose, e-commerce site was using the Adobe Marketing Cloud to achieve this. Here is how they must have used different tools available in the suite.

Adobe Audience Manager consolidate audience information from all available sources and create profiles of audience segment to send email only to you.

 Adobe Campaign used analysis done by Adobe Social and Audience Manager to send you a personalized email. Adobe  Target and Personalization provided you with more suggestions and compelling offers and options. 

You shared your purchase through social sites and the e-commerce site could do more promotions based on the links and shares and could get more people know about the purchase and could listen to the social activity using Adobe Social.

Nice looking website and all the graphics, content along with the personalized options were hosted on Adobe Experience Manager.

Adobe Media Optimizer helps e-commerce site to get maximum return on their investments.

e-commerce site benefited by acquiring the customer by providing a good experience and it can go a long way retaining the customer.

It helped converting a potential user to a customer and sold the product and also received a good follow on social networking sites, which can only lead to more users getting converted to loyal customers.

It is very important to not just reach customers but also need to know them and Adobe Marketing Cloud solutions helps in the same.

Adobe Marketing Cloud is a comprehensive marketing solution which enables marketers to measure, personalize and optimize marketing campaigns and digital experiences for optimal marketing performance. Adobe Marketing Cloud includes a set of analytics, social, advertising, media optimization, targeting, Web experience management and content management aimed at digital marketing.

 It is the most comprehensive & integrated marketing solution for digital marketers.

 Adobe Marketing Cloud Solution consists of –

  1. Adobe Analytics
  2. Adobe Audience Manger
  3. Adobe Campaign
  4. Adobe Experience Manger
  5. Adobe Media Optimiser
  6. Adobe Primetime
  7. Adobe Social
  8. Adobe Target

 We will explore each product in detail in upcoming blogs.

The Performance Guidepost

Imagine on a bright sunny day you open up your analytics dashboard and you notice the visitors graph going high and high and high and suddenly drops all of a sudden.

You will be wondering what is happening, only to find that your colleague had started a nice promotion and due to the promotion the website load increased multifold.

But what happened all of a sudden? Why the drop in visits? Ah… the promotion became too popular as it had gone viral in the social network and print media. And due to the heavy demand more number of users visited and the site could not take up the anticipated load and crashed.

A poor show, in spite the excellent job by marketing team.

What could have been done to avoid such situation and do not let the customer suffer and the drop in sales and site visitors?

Performance testing is the answer on anticipated site load.


What is Performance Testing?

Triple “S” check is a must for the public facing websites.

  • Speed – Determines whether the application responds quickly.
  • Scalability – Determines maximum user load the software application can handle.
  • Stability – Determines if the application is stable under varying loads.

And all three can be measured using performance testing.

Performance testing is the investigation done either to determine or to prove the response time, scalability and performance of the website to ensure that they will perform well under their expected regular workload, at peak load and uncover inconsistencies across different operating systems/devices.

The goal of performance testing is not to find bugs but to eliminate performance bottlenecks and tune the system for maximum load. This is also to determine the maximum threshold the website can take.

Common Performance Problems

Poor Response Time:

Once the user performs an action and user has to wait for so long before the response is provided. This can lead to poor user experience.

Poor Load Distribution:

Poor load distribution can cause slow response time by incorrectly assigning new site visitors to hanged up servers. If too many people are on the same server, they’re going to experience difficulties, even if the overall system is well under capacity. Check the sites of some of the big players and you will notice the site loads in a flash of moments.

Types of Performance Testing

Load Test:

Generally a load test is conducted to understand the behaviour of a system under the specific expected load. It helps to identify the maximum operating capacity of an application as well as any bottlenecks and determine which element is causing degradation. E.g. If the number of users are increased then how much CPU, memory will be consumed, what is the network and bandwidth response time.

It also helps in measuring the response time, throughput rates, and resource-utilization levels, and to identify the breaking point, and the peak load the website can handle.

This can answer questions like, what is the maximum number of users that can use the system without any impact on performance and acceptable response time.

Stress Test:

Stress testing refers to the testing of website to determine whether its performance is satisfactory under any extreme and unfavourable conditions, which may occur as a result of heavy network traffic, process loading and maximum requests for resource utilization. Stress testing enables to identify how the website behaves under extreme load conditions.

This will answer questions like, what is the maximum peak load the system can handle and determine if the system will perform sufficiently if the current load goes well above the expected maximum limits.

Soak / Endurance Test:

This is usually done to determine if the system can sustain the continuous expected load, this helps in detecting potential memory leaks and utilization. Also to check the performance degradation when the system is being used for long duration.

This can answer questions like, if the promotion becomes very popular and the load of system is way beyond for a very long duration, can the system handle such situations?

Spike Test:

Spike testing is a subset of stress testing.  A spike test is a type of performance test focused on determining reaction to a sudden large spikes in the load generated by users.

This can answer questions like, if the competitor, runs a promotion and we are unaware of it, due to such situations users visiting the site for similar promotions on our site, there could be sudden spike of users and if the system can handle such situations.


Lot of performance testing tools are available for different types of tests and it is quite difficult to cover all types of test using one.

Jmeter is one of the renowned open source tool designed to load test functional behaviour and measure performance.

Lets explore more about Jmeter and its functioning in the upcoming blog.


Performance Testing is a must before the website goes to market, as poor performance and inconsistent behaviour of the site may lead to inadequate reputation, poor user experience and will not meet the sales goals.

Hence its concluded that it’s a must to perform performance testing at initial stage of building website and regularly in different intervals. Analytics can help monitor the peak loads and help plan for performance testing. This can go a long way building customer trust, relation and not only retain but expand customer base. Lets read about that too in another upcoming blog.