{"id":22538393,"url":"https://github.com/shuttle/shuttle.esb.sql.subscription","last_synced_at":"2025-07-16T18:41:05.559Z","repository":{"id":59067478,"uuid":"84748385","full_name":"Shuttle/Shuttle.Esb.Sql.Subscription","owner":"Shuttle","description":"Sql-based implementation of ISubscriptionManager interface for use with Shuttle.Esb.","archived":false,"fork":false,"pushed_at":"2025-03-02T14:11:42.000Z","size":169,"stargazers_count":0,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-23T22:14:23.546Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Shuttle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-12T18:41:42.000Z","updated_at":"2025-03-02T14:11:45.000Z","dependencies_parsed_at":"2024-11-30T08:26:29.113Z","dependency_job_id":"d8ea4f0a-5487-4670-bc4a-c6edcc428edd","html_url":"https://github.com/Shuttle/Shuttle.Esb.Sql.Subscription","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shuttle%2FShuttle.Esb.Sql.Subscription","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shuttle%2FShuttle.Esb.Sql.Subscription/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shuttle%2FShuttle.Esb.Sql.Subscription/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shuttle%2FShuttle.Esb.Sql.Subscription/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Shuttle","download_url":"https://codeload.github.com/Shuttle/Shuttle.Esb.Sql.Subscription/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248104858,"owners_count":21048412,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-07T11:11:52.431Z","updated_at":"2025-04-09T20:22:42.970Z","avatar_url":"https://github.com/Shuttle.png","language":"C#","readme":"# SQL\r\n\r\n```\r\nPM\u003e Install-Package Shuttle.Esb.Sql.Subscription\r\n```\r\n\r\nContains a sql-based `ISubscriptionService` implementation.  The subscription service caches all subscriptions but a timeout for the cache may be set.  If you need to be sure that a new subscriber is picked up by a publisher the safest is to restart the relevant publisher(s).\r\n\r\n## Registration\r\n\r\nThe required components may be registered by calling:\r\n\r\n```c#\r\nservices.AddSqlSubscription(builder =\u003e \r\n{\r\n    // defaults\r\n    builder.Options.ConnectionStringName = \"Subscription\";\r\n    builder.Options.Schema = \"dbo\";\r\n    builder.Options.CacheTimeout = TimeSpan.FromMinutes(5);\r\n\r\n    builder.UseSqlServer(); // SqlServer\r\n    builder.UseNpgsql(); // Postgres\r\n});\r\n```\r\n\r\nThe `SubscriptionService` that implements the `ISubscriptionService` interface makes use of the `SubscriptionOptions` configured with the `ServiceBusOptions` to register, or ensure, any subscriptions:\r\n\r\n```c#\r\nservices.AddServiceBus(builder =\u003e \r\n{\r\n\tbuilder.Subscription.SubscribeType = SubscribeType.Normal; // default\r\n\r\n    // add subscription to message types directly; else below options on builder\r\n    builder.Subscription.MessageTypes.Add(messageType);\r\n\r\n    // using type\r\n    builder.AddSubscription(typeof(Event1));\r\n    builder.AddSubscription(typeof(Event2));\r\n\r\n    // using a full type name\r\n    builder.AddSubscription(typeof(Event1).FullName);\r\n    builder.AddSubscription(typeof(Event2).FullName);\r\n\r\n    // using a generic\r\n    builder.AddSubscription\u003cEvent1\u003e();\r\n    builder.AddSubscription\u003cEvent2\u003e();\r\n});\r\n```\r\n\r\nAnd the JSON configuration structure:\r\n\r\n```json\r\n{\r\n  \"Shuttle\": {\r\n    \"Sql\": {\r\n        \"Subscription\": {\r\n          \"ConnectionStringName\": \"Subscription\",\r\n          \"Schema\": \"dbo\",\r\n          \"CacheTimeout\": \"00:05:00\"\r\n        }\r\n    },\r\n    \"ServiceBus\": {\r\n      \"Subscription\": {\r\n        \"SubscribeType\": \"Normal\",\r\n        \"MessageTypes\": [\r\n          \"message-type-a\",\r\n          \"message-type-b\"\r\n        ]\r\n      }\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n## Options\r\n\r\n| Option | Default\t| Description | \r\n| --- | --- | --- |\r\n| `ConnectionStringName`\t | Subscription | The name of the `ConnectionString` to use to connect to the subscription store. |\r\n| `Schema`\t | dbo | The name of the database schema to use when accessing the subscription tables. |\r\n| `CacheTimeout` | `00:05:00` | How long event subscribers should be cached for before refreshing the list. |\r\n\r\nWhen moving to a non-development environment it is recommended that you make use of the `Ensure` option for the `SubscribeType`.\r\n\r\n## Supported providers\r\n\r\n- `Microsoft.Data.SqlClient`\r\n- `Npgsql` / thanks to [hopla](https://github.com/hopla)\r\n\r\nIf you'd like support for another SQL-based provider please feel free to give it a bash and send a pull request if you *do* go this route.  You are welcome to create an issue and assistance will be provided where possible.\r\n\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshuttle%2Fshuttle.esb.sql.subscription","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshuttle%2Fshuttle.esb.sql.subscription","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshuttle%2Fshuttle.esb.sql.subscription/lists"}