# Connecting endpoints The ServicePlatform Connector plugin provides a unified API to connect an NServiceBus endpoint to the Particular Service Platform by configuring: - an [error queue](/nservicebus/recoverability/configure-error-handling.md#configure-the-error-queue-address-using-code) address - [message auditing](/nservicebus/operations/auditing.md) - [saga auditing](/nservicebus/sagas/saga-audit.md) - [performance metrics](/monitoring/metrics/index.md) collection - [custom checks](/monitoring/custom-checks/install-plugin.md) - [heartbeats](/monitoring/heartbeats/index.md) ## JSON The connection details can be parsed from JSON with [a specific configuration schema](json-schema.md). ```cs var json = File.ReadAllText(pathToJson); var platformConnection = ServicePlatformConnectionConfiguration.Parse(json); endpointConfiguration.ConnectToServicePlatform(platformConnection); ``` The JSON file looks like this: ```json { "ErrorQueue": "myErrorQueue", "Heartbeats": { "Enabled": true, "HeartbeatsQueue": "heartbeatsQueue" }, "CustomChecks": { "Enabled": true, "CustomChecksQueue": "customChecksQueue" }, "MessageAudit": { "Enabled": true, "AuditQueue": "myAuditQueue" }, "SagaAudit": { "Enabled": true, "SagaAuditQueue": "sagaAuditQueue" }, "Metrics": { "Enabled": true, "MetricsQueue": "metricsQueue", "Interval": "00:00:10" } } ``` A JSON file specific to a concrete deployment of the ServicePlatform is available via ServicePulse. ![Screenshot of ServicePulse showing the configuration endpoint connection JSON file tab](connecting.servicepulse.png) ## Code first The connection details can be constructed in code. ```cs var platformConnection = new ServicePlatformConnectionConfiguration { ErrorQueue = "myErrorQueue", Heartbeats = new ServicePlatformHeartbeatConfiguration { Enabled = true, HeartbeatsQueue = "heartbeatsQueue" }, CustomChecks = new ServicePlatformCustomChecksConfiguration { Enabled = true, CustomChecksQueue = "customChecksQueue" }, MessageAudit = new ServicePlatformMessageAuditConfiguration { Enabled = true, AuditQueue = "myAuditQueue" }, SagaAudit = new ServicePlatformSagaAuditConfiguration { Enabled = true, SagaAuditQueue = "sagaAuditQueue" }, Metrics = new ServicePlatformMetricsConfiguration { Enabled = true, MetricsQueue = "metricsQueue", Interval = TimeSpan.FromSeconds(60) } }; endpointConfiguration.ConnectToServicePlatform(platformConnection); ``` ## Combined Configuration can be loaded from JSON and then overridden in code. ```cs var json = File.ReadAllText(pathToJson); var platformConnection = ServicePlatformConnectionConfiguration.Parse(json); platformConnection.Heartbeats.Enabled = false; platformConnection.Metrics.InstanceId = "MyCustomInstanceId"; endpointConfiguration.ConnectToServicePlatform(platformConnection); ```