No Heartbeat Monitoring on SendOnly Endpoint and Heartbeat Monitoring on Receiving Endpoint

I am using NSB 7.7.3 and .NET 6.

My application was working well with the exception of continuous Heartbeat errors, so I made the endpoint generating the errors a SendOnly endpoint as discussed in this post:

Configure Quartz.NET to Trigger Sending Batches of Messages Without Heartbeat Errors

When endpointConfiguration.SendOnly(); is in my code it generates

System.Exception: Metrics are not supported on send only endpoints.

The exception is raised during Endpoint.Create and causes the endpoint to be null, stopping my application from functioning. Is there a way to suppress this exception or exclude the SendOnly endpoint from Heartbeat monitoring so that the receiving endpoint’s Heartbeat can still be monitored without the SendOnly endpoint raising exceptions? Thank you.

Heartbeats have to be specifically enabled, they aren’t on by default.

You have to include the Heartbeat plugin and then call the configuration code, as described in this article.

So the fix is…don’t do that. :wink:

Thanks David. I was following the instructions in the Connect to ServicePlatform with JSON configuration, which is a global configuration that affected all endpoints. Pulling the JSON Heartbeats code and configuring the endpoints separately as you recommended is definitely the way to resolve this issue.

Unfortunately, the issue in Configure Quartz.NET to Trigger Sending Batches of Messages Without Heartbeat Errors still occurs (albeit now on the receiving endpoint), so I had to pull Heartbeats entirely (as you suggested might be necessary). C’est la vie! Appreciate all your help with this.

You could also keep the JSON configuration, parse it, and then if the endpoint is meant to be send-only, set the platformConnection.Heartbeats.Enabled = false before calling endpointConfiguration.ConnectToServicePlatform(platformConnection).

1 Like