Hosting integration
Thresh.Hosting helps run Thresh safely in service-style applications.
Typical setup
builder.Services
.AddThresh(options =>
{
options.AcceptSelfSignedCertificates = true;
options.WsAcceptSelfSignedCertificates = true;
})
.AddThreshEndpoints();
Then register your own hosted service that consumes ILcuHttpClient, endpoint APIs, or IEventStream.
Recommended lifecycle model
- Connect
IEventStreamat startup. - Wait for connectivity with a bounded timeout.
- Subscribe handlers.
- Dispose subscriptions and stream during shutdown.
Reliability tips
- Keep startup resilient to temporary client absence.
- Prefer structured logs with endpoint/path context.
- Use health checks for readiness signaling in orchestrated environments.