# I want to send the notification once in a day for an alarm getting created every minute or 10 min or etc through apama epl

**URL:** <https://community.cumulocity.com/t/i-want-to-send-the-notification-once-in-a-day-for-an-alarm-getting-created-every-minute-or-10-min-or-etc-through-apama-epl/2622>\
**Category:** Forum\
**Tags:** Streaming-Analytics-Apama, device-connectivity, cumulocity\
**Created:** [October 11, 2023, 1:07pm UTC](https://community.cumulocity.com/t/i-want-to-send-the-notification-once-in-a-day-for-an-alarm-getting-created-every-minute-or-10-min-or-etc-through-apama-epl/2622 "2023-10-11T13:07:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jkpatil1010](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jkpatil1010](https://community.cumulocity.com/u/jkpatil1010)\
**Post date:** [October 11, 2023, 1:07pm UTC](https://community.cumulocity.com/t/i-want-to-send-the-notification-once-in-a-day-for-an-alarm-getting-created-every-minute-or-10-min-or-etc-through-apama-epl/2622/1 "2023-10-11T13:07:43Z")

</div>

Hi,

I want to send notification when alarm is generated first and if the alarm is keep on generating and not acknowledged, i dont want to send notification when every time the alarm is created(ex. every minute) instead i want to send the notification only once in day, after the alarm generated In Apama EPL.

help me with the code snippet for Apama Epl.

---

<div class="post-metadata">

**Author:** ![joel.dockray](https://avatars.discourse-cdn.com/v4/letter/j/76d3ee/32.png) [@joel.dockray](https://community.cumulocity.com/u/joel.dockray)\
**Post date:** [October 11, 2023, 2:18pm UTC](https://community.cumulocity.com/t/i-want-to-send-the-notification-once-in-a-day-for-an-alarm-getting-created-every-minute-or-10-min-or-etc-through-apama-epl/2622/2 "2023-10-11T14:18:46Z")

</div>

You might find the _count_ member of the [Alarm event](https://documentation.softwareag.com/pam/10.15.3/en/webhelp/related/ApamaDoc/index.html?com/apama/cumulocity/Alarm.html) useful. This will be 1 the first time the alarm is triggered so can be used for filtering in an [_on_ statement](https://documentation.softwareag.com/pam/10.15.3/en/webhelp/pam-webhelp/index.html#page/pam-webhelp%2Fre-DevApaAppInEpl_specifying_the_on_statement.html) in order to send a notification.

If alarms are generated at very regular intervals (for example, exactly every minute) then it might be sufficient to [listen for alarms](https://documentation.softwareag.com/pam/10.15.3/en/webhelp/pam-webhelp/index.html#page/pam-webhelp%2Fta-DevApaAppInEpl_using_name_value_syntax_to_listen_for_events_with_particular_content.html%23) with [_status_ “ACTIVE”](https://documentation.softwareag.com/pam/10.15.3/en/webhelp/related/ApamaDoc/com/apama/cumulocity/Alarm.html#status) that have a count divisible by the number of minutes in a day using the [modulo operator](https://documentation.softwareag.com/pam/10.15.3/en/webhelp/pam-webhelp/index.html#page/pam-webhelp%2Fre-ApaEplRef_multiplicative_operators.html%23wwconnect_header) to get reminders roughly every day. It is possible this method of filtering has not been implemented. Alternatively, you could start a 1 day timing listener in response to the first alarm event (see the [wait operator](https://documentation.softwareag.com/pam/10.15.3/en/webhelp/pam-webhelp/index.html#page/pam-webhelp%2Fco-EplQueRun_query_wait_operator.html)) that stops (is cancelled) if an alarm event is received with ACKNOWLEDGED or CLEARED _status_.  
`on all (wait(5.0)) and not Alarm(status!="ACTIVE")`  
This uses the _and_ and _not_ [event listener logic](https://documentation.softwareag.com/pam/10.15.3/en/webhelp/pam-webhelp/index.html#page/pam-webhelp%2Fco-DevApaAppInEpl_specifying_and_or_xor_not_logic_in_event_listeners.html%23).

Rather than starting a timer for each alarm you could alternatively [query for alarms](https://documentation.softwareag.com/pam/10.15.3/en/webhelp/pam-webhelp/index.html#page/pam-webhelp%2Fco-ConApaAppToExtCom_cumulocity_querying_for_alarms.html) that are active [at a particular time each day](https://documentation.softwareag.com/pam/10.15.3/en/webhelp/pam-webhelp/index.html#page/pam-webhelp%2Fta-DevApaAppInEpl_triggering_event_listeners_at_specific_times.html%23).

---

<div class="post-metadata">

**Author:** ![punam90singh](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/punam90singh/32/29909_2.png) [@punam90singh](https://community.cumulocity.com/u/punam90singh)\
**Post date:** [October 11, 2023, 4:34pm UTC](https://community.cumulocity.com/t/i-want-to-send-the-notification-once-in-a-day-for-an-alarm-getting-created-every-minute-or-10-min-or-etc-through-apama-epl/2622/3 "2023-10-11T16:34:39Z")

</div>

This can be achieve by defining 2 EPL apps, one will listen only new active alarm where count is 1 and send notification

And another EPL can be run at any particular time daily to fetch all the alarms that are still active and created date is older than today.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/system/32/31990_2.png) [@system](https://community.cumulocity.com/u/system)\
**Post date:** [April 8, 2024, 4:35pm UTC](https://community.cumulocity.com/t/i-want-to-send-the-notification-once-in-a-day-for-an-alarm-getting-created-every-minute-or-10-min-or-etc-through-apama-epl/2622/4 "2024-04-08T16:35:14Z")

</div>

Closed on April 8, 2024, 4:35pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
