{"id":28448562,"url":"https://github.com/araditc/arad.sms.core.dbreader","last_synced_at":"2026-02-15T15:43:18.534Z","repository":{"id":242513830,"uuid":"767396456","full_name":"araditc/arad.sms.core.dbreader","owner":"araditc","description":"DB Reader is a service for managing inbound/outbound messages, connecting to Oracle, SQL Server, and MySQL. It reads messages from the Outbound table and sends them via Arad ITC's web service. Utilizes Threading for high-volume processing and supports message receipt and delivery updates via GetDLR/GetMO web services or Webhook.","archived":false,"fork":false,"pushed_at":"2025-08-10T06:09:52.000Z","size":322,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-10T08:24:12.940Z","etag":null,"topics":["arad","arad-itc","db-reader","mysql","rest-api","sendsms","sms","sql"],"latest_commit_sha":null,"homepage":"https://arad-itc.com","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/araditc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2024-03-05T08:15:25.000Z","updated_at":"2025-08-10T06:09:56.000Z","dependencies_parsed_at":"2025-06-30T13:45:23.327Z","dependency_job_id":"31396e5a-6125-4143-8a92-7bf16a9351b4","html_url":"https://github.com/araditc/arad.sms.core.dbreader","commit_stats":null,"previous_names":["araditc/arad.sms.core.dbreader"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/araditc/arad.sms.core.dbreader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/araditc%2Farad.sms.core.dbreader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/araditc%2Farad.sms.core.dbreader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/araditc%2Farad.sms.core.dbreader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/araditc%2Farad.sms.core.dbreader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/araditc","download_url":"https://codeload.github.com/araditc/arad.sms.core.dbreader/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/araditc%2Farad.sms.core.dbreader/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29482699,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T15:33:17.885Z","status":"ssl_error","status_checked_at":"2026-02-15T15:32:53.698Z","response_time":118,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["arad","arad-itc","db-reader","mysql","rest-api","sendsms","sms","sql"],"created_at":"2025-06-06T13:09:11.120Z","updated_at":"2026-02-15T15:43:18.527Z","avatar_url":"https://github.com/araditc.png","language":"C#","readme":"👉 [نسخه پارسی](https://github.com/araditc/arad.sms.core.dbreader/blob/master/README_FA.md)\n\n# Arad SMS Core DBReader\n\n## Project Overview\n\n`arad.sms.core.dbreader` is a high-performance message ingestion and dispatch service designed to interface with Oracle, SQL Server, and MySQL databases. It reads outbound SMS messages from a database, delivers them via Arad SMS Web Service, and stores inbound messages and delivery receipts using API calls or Webhooks.\n\nIt is an essential module in Arad's SMS infrastructure, built with multithreaded architecture for maximum throughput and reliability.\n\n---\n\n## Key Features\n\n- **Database Connectivity**:\n  - Supports Oracle, SQL Server, and MySQL\n  - Reads from two key tables:\n    - `Outbound`: Stores messages to be sent\n    - `Inbound`: Stores received messages\n\n- **Message Dispatch**:\n  - Reads messages from the `Outbound` table\n  - Sends messages via Arad SMS Web API\n\n- **Delivery Report Handling**:\n  - Supports two modes:\n    - API-based `GetDLR` polling\n    - Webhook-based delivery status push\n\n- **Inbound Message Reception**:\n  - Pull via API (`GetMO`) or accept via Webhook\n  - Stores messages in the `Inbound` table\n\n- **Internal API**:\n  - Accepts user messages and queues them for dispatch via Arad Web Service\n\n- **Error Management**:\n  - Compliant with Arad’s official standards  \n    👉 [API Docs](https://github.com/araditc/arad.sms.core.api.document)\n\n- **Archiving \u0026 Cleanup**:\n  - Automatically archives old messages\n  - Removes duplicate or obsolete records\n\n---\n\n## Architecture \u0026 Technical Highlights\n\n- **Multithreaded Design**:\n  Ensures concurrent processing of high-volume message traffic.\n\n- **Configuration-Driven**:\n  Uses `appsettings.json` for all runtime configuration—databases, APIs, archiving, logging, error alerts, and more.\n\n- **Protocol Support**:\n  Fully aligned with Arad Web API standards, including Swagger-documented internal API endpoints.\n\n---\n\n## Configuration – `appsettings.json`\n\nA few important configuration blocks:\n\n- **LogConfig**: Logging location, file rotation, and retention\n- **DB**: All SQL queries used for send, receive, update, archive\n- **Message**: TPS control, batching, delivery polling intervals\n- **SmsEndPointConfig**: Arad API authentication and versioning\n- **ArchiveTimeSettings**: Archive scheduler (start/end time and batch size)\n- **AlertSetting**: Threshold-based alert messaging\n- **URLSetting**: Internal API hosting (IP, port, API key)\n\n👉 See full `appsettings.json` structure in the project for details.\n\n```json\n{\n  \"LogConfig\": {\n    \"LogFileAddressDirectory\": \"C:\\\\Arad.SMS.Core\\\\Logs\\\\ProxyDB\\\\\",\n    \"LogFileName\": \"Proxy.Log\",\n    \"FileSizeLimit\": 10000000,\n    \"RetainedFileCountLimit\": 1500\n  },\n  \"DB\": {\n    \"Provider\": \"MySQL\",\n    \"ConnectionString\": \"Server=localhost;Database=test;Uid=root;Pwd=12346;\",\n    \"SelectQueryForSend\": \"SELECT outboundmessage_id as ID, from_mobile_number as SOURCEADDRESS, dest_mobile_number as DESTINATIONADDRESS, message_body as MESSAGETEXT from outbound_messages where status is null LIMIT {0}\", //if query start with SP: then you can use stored procedure and with param name =\u003e @mps\n    \"UpdateQueryBeforeSend\": \"UPDATE outbound_messages set status = 'WaitingForSend' where outboundmessage_id in ({0});\",\n    \"UpdateQueryAfterSend\": \"UPDATE outbound_messages set status = '{0}', sent_time = '{1}', ticket = '{2}', selection_id = {3}, UpstramGateway = {4} where outboundmessage_id = {5};\",\n    \"StatusForSuccessSend\": \"Sent\",\n    \"UpdateQueryAfterFailedSend\": \"UPDATE outbound_messages set status = '{0}' where outboundmessage_id = {1};\",\n    \"StatusForFailedSend\": \"ErrorInSending\",\n    \"StatusForStore\": \"Stored\",\n    \"SelectQueryForGetDelivery\": \"select ticket from outbound_messages where status = 'Sent' and sent_time \u003e date_sub(now(), INTERVAL 6 hour) LIMIT 900 offset {0}\",\n    \"UpdateQueryForDelivery\": \"UPDATE outbound_messages set status = '{0}', update_time = '{1}' where ticket = '{2}';\",\n    \"InsertQueryForInbox\": \"INSERT INTO inbound_messages (source_number, mobile_number, date, message) VALUES ('{0}','{1}','{2}','{3}');\",\n    \"SelectQueryForNullStatus\": \"SELECT COUNT(*) as count from outbound_messages where status is null;\",\n    \"SelectQueryForArchive\": \"SELECT outboundmessage_id as ID, creation_date as CreationDate FROM outbound_messages where DATE(creation_date) \u003c= DATE(DATE_SUB(SYSDATE(), INTERVAL 4 DAY)) limit {0};\",\n    \"OutboxTableName\": \"outbound_messages\",\n    \"InsertQueryForArchive\": \"INSERT INTO {0} SELECT * FROM outbound_messages where outboundmessage_id in ({1});\",\n    \"DeleteQueryAfterArchive\": \"DELETE FROM outbound_messages WHERE outboundmessage_id IN ({0})\",\n    \"DeleteQueryForDuplicateRecords\": \"DELETE from {0} where outboundmessage_id IN (SELECT outboundmessage_id FROM outbound_messages where DATE(creation_date) \u003c= DATE(DATE_SUB(SYSDATE(), INTERVAL 4 DAY)));\",\n    \"SelectQueryWhiteList\": \"select mobile from whitelist where mobile in ({0})\",\n    \"InsertQueryForOutbox\": \"INSERT outbound_messages (from_mobile_number, dest_mobile_number, message_body, creation_date, message_id) VALUES ('{0}','{1}','{2}', '{3}', {4});\",\n    \"SelectDeliveryQuery\": \"select status from outbound_messages where message_id in ({0});\"\n  },\n  \"FullLog\": false,\n  \"Message\": {\n    \"TPS\": 1000,\n    \"BatchSize\": 500,\n    \"EnableSend\": true,\n    \"EnableGetDLR\": true,\n    \"EnableGetMO\": true,\n    \"DLRInterval\": 60,\n    \"MOInterval\": 60,\n    \"SendToWhiteList\": false\n  },\n  \"ServiceName\": \"DbProxy_Reader\",\n  \"SmsEndPointConfig\": {\n    \"SmsEndPointBaseAddress\": \"http://localhost:50004\",\n    \"UserName\": \"user\",\n    \"Password\": \"pass\",\n    \"UseApiKey\": true,\n    \"ApiKey\": \"+u\",\n    \"ReturnLongId\": false,\n    \"ApiVersion\": 4,\n    \"Timeout\": 10 // sec\n  },\n  \"BulkTimeSettings\": {\n    \"Start\": \"00:00:00\",\n    \"End\": \"23:59:59\"\n  },\n  \"ArchiveTimeSettings\": {\n    \"EnableArchive\": true,\n    \"Start\": \"00:00:00\",\n    \"End\": \"04:00:00\",\n    \"BatchSize\": 5000\n  },\n  \"AlertSetting\": {\n    \"SourceAddress\": \"98xxx\",\n    \"DestinationAddress\": \"989xxxxxx\",\n    \"ErrorCount\": \"100\",\n    \"IntervalTime\": \"10\",\n    \"QueueCount\": \"5000\"\n  },\n  \"URLSetting\": {\n    \"IP\": \"127.0.0.1\",\n    \"Port\": \"8888\",\n    \"SendApiKey\": \"123456\"\n  }\n}\n```\n\n---\n\n## Installation\n\n### Prerequisites\n\n- Oracle / SQL Server / MySQL database\n- Valid Arad SMS Web Service credentials (username, password, API key)\n- .NET runtime environment (tested on .NET Core 8+)\n\n---\n\n## Setup \u0026 Run\n\n```bash\ngit clone https://github.com/araditc/arad.sms.core.dbreader\ncd arad.sms.core.dbreader\ndotnet restore\ndotnet run\n```\n\n---\n\n## Deploying as a Windows Service\n\n1. Publish the project via Visual Studio\n2. Install the service using:\n\n```bash\nsc create DbProxy_Reader binpath=\"C:\\Path\\To\\Published\\dbreader.exe\"\n```\n\n3. Manage service:\n\n```bash\nsc start DbProxy_Reader\nsc stop DbProxy_Reader\nsc delete DbProxy_Reader\n```\n\n*Note: Run these in an Administrator Command Prompt.*\n\n---\n\n## Deploying on Linux (systemd)\n\n1. Publish project:\n\n```bash\ndotnet publish -c Release -o /path/to/publish\n```\n\n2. Create systemd service:\n\n```bash\nsudo nano /etc/systemd/system/dbproxy_reader.service\n```\n\n3. Add content:\n\n```ini\n[Unit]\nDescription=Arad SMS Core DB Reader Service\nAfter=network.target\n\n[Service]\nExecStart=/path/to/publish/dbreader --urls \"http://0.0.0.0:8888\"\nWorkingDirectory=/path/to/publish\nRestart=always\nUser=your_user\nEnvironment=ASPNETCORE_ENVIRONMENT=Production\n\n[Install]\nWantedBy=multi-user.target\n```\n\n4. Start service:\n\n```bash\nsudo systemctl enable dbproxy_reader.service\nsudo systemctl start dbproxy_reader.service\n```\n\n5. Manage:\n\n```bash\nsudo systemctl status dbproxy_reader.service\nsudo systemctl stop dbproxy_reader.service\nsudo systemctl disable dbproxy_reader.service\n```\n\n---\n\n## Troubleshooting\n\n- **Database Connection**:\n  - Verify `ConnectionString` and `Provider` in `appsettings.json`\n- **API Auth Failure**:\n  - Check `SmsEndPointBaseAddress`, `UserName`, `Password`, and `ApiKey`\n- **No Delivery or Inbound**:\n  - Confirm Webhook endpoints are accessible\n- **Debug Logs**:\n  - Located at `LogConfig.LogFileAddressDirectory`\n\n---\n\n## Documentation\n\n- [Arad SMS Core API Documentation](https://github.com/araditc/arad.sms.core.api.document)\n- Swagger support for internal API\n\n---\n\n## License\n\n© Arad ITC. All rights reserved.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faraditc%2Farad.sms.core.dbreader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faraditc%2Farad.sms.core.dbreader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faraditc%2Farad.sms.core.dbreader/lists"}