# MicroserviceSubscription AddedEvent vs MicroserviceSubscriptions InitializedEvent

**URL:** <https://community.cumulocity.com/t/microservicesubscription-addedevent-vs-microservicesubscriptions-initializedevent/780>\
**Category:** Forum\
**Tags:** cumulocity\
**Created:** [November 11, 2022, 1:24pm UTC](https://community.cumulocity.com/t/microservicesubscription-addedevent-vs-microservicesubscriptions-initializedevent/780 "2022-11-11T13:24:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Voigt2](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/michael_voigt2/32/18431_2.png) [@Michael\_Voigt2](https://community.cumulocity.com/u/Michael_Voigt2)\
**Post date:** [November 11, 2022, 1:24pm UTC](https://community.cumulocity.com/t/microservicesubscription-addedevent-vs-microservicesubscriptions-initializedevent/780/1 "2022-11-11T13:24:15Z")

</div>

#### What product/components do you use and which version/fix level are you on?

C8Y MS SDK 1009.0.12

#### What are you trying to achieve? Please describe it in detail.

I wonder what the difference is between MicroserviceSubscriptionAddedEvent vs MicroserviceSubscriptionsInitializedEvent and when to use which one. I found [Create tenant option if it is not presented. (Java microservice SDK)](https://community.cumulocity.com/t/create-tenant-option-if-it-is-not-presented-java-microservice-sdk/7587) which explains the MicroserviceSubscriptionAddedEvent quite good, but not the difference.

I have a suspicion based on the sparse documentation ([com.cumulocity.microservice.subscription.model (Cumulocity Microservice SDK)](http://resources.cumulocity.com/documentation/microservicesdk/current/com/cumulocity/microservice/subscription/model/package-summary.html)), but I don’t want to use something wrong so I’d like to get the experts input here.

Thanks a lot!  
Michael

---

<div class="post-metadata">

**Author:** ![Kai\_Sieben](https://dub1.discourse-cdn.com/flex005/user_avatar/community.cumulocity.com/kai_sieben/32/5541_2.png) [@Kai\_Sieben](https://community.cumulocity.com/u/Kai_Sieben)\
**Post date:** [November 11, 2022, 2:07pm UTC](https://community.cumulocity.com/t/microservicesubscription-addedevent-vs-microservicesubscriptions-initializedevent/780/2 "2022-11-11T14:07:16Z")

</div>

Hi Michael,  
the difference is following:

**MicroserviceSubscriptionsInitializedEvent** : This event is only triggered once, after the microservice is starting up and initialised its subscriptions. This is independent on the number of subscribed tenants.

**MicroserviceSubscriptionAddedEvent** : This event is triggered any time a tenant is subscribed to a microservice:

1. After the microservice started up, one event for each subscribed tenant.
2. When a tenant is subscribed to it any time later during runtime. Same applies for the **MicroserviceSubscriptionRemovedEvent** in case tenants are unsubscribed.

In general the difference is only useful in a multi-tenant microservice (isolation level `MULTI_TENANT`). A single tenant (`PER_TENANT`) microservice instance is anyway shut down after the single tenant is unsubscribed and only starts if the single tenant is subscribed, hence in `PER_TENANT` mode there is no difference. Nevertheless the **MicroserviceSubscriptionRemovedEvent** could be useful here too.

Regards Kai

---

<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:** [May 10, 2023, 2:07pm UTC](https://community.cumulocity.com/t/microservicesubscription-addedevent-vs-microservicesubscriptions-initializedevent/780/3 "2023-05-10T14:07:25Z")

</div>

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