Delete Inactive endpoints

What is the best way to delete Inactive endpoints automatically.
Both from Heartbeats in SerivcePulse and Endpoint list in ServiceInsight (is it the same source maybe?)

We have retention policy (24h) in our short retention environment. I would be nice if endpoints would be cleaned up as well. The messages are cleaned up automatically.

I was thinking about calling Delete on ServiceControl api is there any simpler way to achieve this.

Hi @Eirikur_Haraldsson,

There isn’t an automatic way to purge inactive endpoints. Exercising the ServiceControl API is the only option.

Let me try to dig a bit deeper into your scenario. It sounds like a new ServicePulse/ServiceControl feature might be a good idea.

If you’re using heartbeats, even if the message retention is short, how come endpoints become inactive?

The reason they become inactive is because they are running in a container as part of a pull request, every container has a unique comptername and the container is automatically stopped after 4 hours.

Each branch consumes a isolated queue (using a postfix in the name)

I see. Thanks for the additional details.

One option would be to use ServiceControl integration events and use the HeartbeatStopped event to determine when to invoke the delete API in ServiceControl.

In the meantime, I raised User cannot set retention for inactive endpoionts · Issue #3260 · Particular/ServiceControl · GitHub

1 Like

@mauroservienti wouldn’t deleting a perceived inactive endpoint based on a single HeartbeatStopped be risky? If heartbeats failed within heartbeat grace period, and that fine has exceeded but the endpoint is still alive, the endpoint would be removed while still running.


invoke the delete API in ServiceControl

Is API documented?

That’s correct, in a rush I didn’t provide more details. The endpoint that subscribes to ServiceControl events should have a saga with a timeout that allows to invoke the (not documented) HTTP API after a user-defined period of time.

We are stopping the endpoints (containers) with a script when they expire using script, so we could could invoke Delete API at the same time.

But we would prefer that NServiceBus environment could by itself handle the cleaning up process.

Something like this would be super:


(When the endpoint is created in RavenDb it would have some TTL, and would be removed after that)

What url can be used to delete an endpoint
DELETE …:33333/api/endpoints/myendpointname returns 405 Method Not Allowed