All Projects → ardacetinkaya → depremkontrol

ardacetinkaya / depremkontrol

Licence: other
Simple demonstration of .NET Core 3.0 - BackgroundService to create long-running IHostedService applications

Programming Languages

C#
18002 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to depremkontrol

aspnet-core-3-role-based-authorization-api
ASP.NET Core 3.1 - Role Based Authorization API
Stars: ✭ 110 (+746.15%)
Mutual labels:  dotnetcore, dotnetcore3
ASPNETcoreAngularJWT
Angular in ASP.NET Core with JWT solution by systemjs
Stars: ✭ 48 (+269.23%)
Mutual labels:  dotnetcore, dotnetcore3
aspnet-core-3-basic-authentication-api
ASP.NET Core 3.1 - Basic HTTP Authentication API
Stars: ✭ 70 (+438.46%)
Mutual labels:  dotnetcore, dotnetcore3
Discord.Net-Example
Discord.Net Example bots
Stars: ✭ 104 (+700%)
Mutual labels:  dotnetcore
King.Service
Task scheduling for .NET
Stars: ✭ 34 (+161.54%)
Mutual labels:  dotnetcore
Health
App Metrics Health is an open-source and cross-platform .NET library used to define and report application health checks
Stars: ✭ 25 (+92.31%)
Mutual labels:  dotnetcore
Home
Asp.net core Mvc Controls Toolkit
Stars: ✭ 33 (+153.85%)
Mutual labels:  dotnetcore
Waveshare.EPaperDisplay
.Net Core Library to show images on Waveshare E-Paper Displays
Stars: ✭ 17 (+30.77%)
Mutual labels:  dotnetcore
dotnet-upforgrabs
.NET Core Global Tool to help you get started with contributing to Open Source projects.
Stars: ✭ 50 (+284.62%)
Mutual labels:  dotnetcore
EnyimMemcachedCore
A Memcached client for .NET Core. Available on Nuget https://www.nuget.org/packages/EnyimMemcachedCore
Stars: ✭ 143 (+1000%)
Mutual labels:  dotnetcore
google-photos-upload
Upload a local image directory into an Album in Google Photos (works on mac/pc/linux). Coded in C# .NET Core 3.0
Stars: ✭ 26 (+100%)
Mutual labels:  dotnetcore
AspNetCoreAzureSearch
ASP.NET Core with Azure Cognitive Search
Stars: ✭ 12 (-7.69%)
Mutual labels:  dotnetcore
flutter foreground task
This plugin is used to implement a foreground service on the Android platform.
Stars: ✭ 41 (+215.38%)
Mutual labels:  background-service
JT809DotNetty
JT809DotNetty
Stars: ✭ 30 (+130.77%)
Mutual labels:  dotnetcore
dotnetlive.search
Asp.Net Core + ElasticSearch
Stars: ✭ 18 (+38.46%)
Mutual labels:  dotnetcore
docker-workshop-with-react-aspnetcore-redis-rabbitmq-mssql
An Asp.Net Core Docker workshop project that includes react ui, redis, mssql, rabbitmq and azure pipelines
Stars: ✭ 53 (+307.69%)
Mutual labels:  dotnetcore
NStore
Opinionated eventsourcing library
Stars: ✭ 81 (+523.08%)
Mutual labels:  dotnetcore
maruko
maruko是一个基于dotnetcore的快速开发框架,他实现freesql,automap,模块化,DDD 设计思想等常用性功能.
Stars: ✭ 29 (+123.08%)
Mutual labels:  dotnetcore
Okanshi
mvno.github.io/okanshi
Stars: ✭ 14 (+7.69%)
Mutual labels:  dotnetcore
EasyTokenGenerator
This repo aims to dynamically and simply generate tokens in Token Based systems.
Stars: ✭ 15 (+15.38%)
Mutual labels:  dotnetcore

depremkontrol

This is a simple .NET Core 3.0 BackgroundService application. New BackgroundService API provides implementation ways to create long-running background workers, asynchronous tasks, schedule tasks in operating system. In *Unix kind OS, this kind of .NET Core application also works as systemd service with unit files.

This application can run on Rasbian OS, Raspberry Pi device.

Background Task

This application fetches earthquake data from Boğaziçi University Kandilli Observatory And Earthquake Research Institute's web page. The background job parses HTML content with regular expression due to no reliable API exists.

New BackgroundServicein .NET Core 3.0 provides steady flow for background jobs. With IHostApplicationLifetime registering ApplicationStartted, ApplicationStarting and ApplicationStopped events are simple so control over job is more solid.

The main structure of long-running operation is written in ExecuteAsync(CancellationToken stoppingToken) method. Please check Worker.cs

        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            try
            {
                while (!stoppingToken.IsCancellationRequested)
                {
                    .............
                    ..........
                    .......
                    .....
                    ....
                    //Wait a little bit for next check
                    await Task.Delay(_settings.Value.Period, stoppingToken);
                }
            }
            catch (Exception ex)
            {

            }
        }

Unit file

Check earthquake.service file for service description for *Unix systems.

After creating the file, be sure to copy it to /etc/systemd/system path.

Example:

cp /home/pi/projects/earthquake-checker/earthquake.service /etc/systemd/system/earthquake.service

Some service operations;

systemctl daemon-reload         # make systemd reload the unit files to reflect changes
systemctl start earthquake      # start the service
systemctl stop earthquake       # start the service
systemctl enable earthquake     # install the service so it is started automatically

More fun 😃

.NET Core can also run on devices such as Raspberry Pi with NET Core 3.0 SDK - Linux ARM32 version. Any IoT scenario can be done with .NET Core 3.0 such as getting some sensor data, setting a device and monitor an environment....etc.

So, I run application this application on Raspberry Pi 3 with OLED display. So even if new earthquake data is fetched it is displayed on OLED at device. The display stuff is not related with .NET Core 3.0, it is just one of my previous python code with HTTP server feature to get input. Don't forget to check...

Raspberry Pi Device

Azure IoT Central

I just wantted to dig a little bit to learn more about Azure IoT Central so this application also registered as a IoT device and send data to Azure IoT Central endpoints to monitor device. Also review this code in IoT aspect...

Simplify IoT development—from setup to production Build production-grade IoT applications in hours, without managing infrastructure or relying on advanced IoT development skills. Reduce the complexity of customizing, deploying, and scaling an IoT solution—and bring your connected solutions to market faster.

Briefly, Azure IoT Central is a very good platform to manage IoT devices; device management, device provisioning can be done easily.

To dig more about to topics in this repository, please check followings;

Happy coding ❤️

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].