Compare commits
9 Commits
BIN
.gitea/readme/icon.png
Normal file
BIN
.gitea/readme/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
34
.gitea/workflows/build.yml
Normal file
34
.gitea/workflows/build.yml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
name: Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "dev"
|
||||||
|
paths:
|
||||||
|
- "TimetableDesigner.Backend.Events.Providers.RabbitMQ**"
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- "dev"
|
||||||
|
- "main"
|
||||||
|
paths:
|
||||||
|
- "TimetableDesigner.Backend.Events.Providers.RabbitMQ**"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build
|
||||||
|
runs-on: linux
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
- name: Setup .NET
|
||||||
|
uses: actions/setup-dotnet@v4
|
||||||
|
with:
|
||||||
|
dotnet-version: 10.0.x
|
||||||
|
- name: Add package source
|
||||||
|
run: dotnet nuget add source --name gitea --username TimetableDesigner --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text https://repos.mateuszskoczek.com/api/packages/TimetableDesigner/nuget/index.json
|
||||||
|
- name: Restore dependencies
|
||||||
|
run: dotnet restore
|
||||||
|
- name: Build
|
||||||
|
run: dotnet build --no-restore
|
||||||
|
- name: Create NuGet package
|
||||||
|
run: dotnet pack -c Debug --output ./
|
||||||
100
.gitea/workflows/build_publish.yml
Normal file
100
.gitea/workflows/build_publish.yml
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
name: Build and publish package
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
branches:
|
||||||
|
- "main"
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "main"
|
||||||
|
paths:
|
||||||
|
- "TimetableDesigner.Backend.Events.Providers.RabbitMQ**"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build
|
||||||
|
runs-on: linux
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
- name: Setup .NET
|
||||||
|
uses: actions/setup-dotnet@v4
|
||||||
|
with:
|
||||||
|
dotnet-version: 10.0.x
|
||||||
|
- name: Add package source
|
||||||
|
run: dotnet nuget add source --name gitea --username TimetableDesigner --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text https://repos.mateuszskoczek.com/api/packages/TimetableDesigner/nuget/index.json
|
||||||
|
- name: Restore dependencies
|
||||||
|
run: dotnet restore
|
||||||
|
- name: Build
|
||||||
|
run: dotnet build --no-restore
|
||||||
|
version:
|
||||||
|
name: Determine version
|
||||||
|
runs-on: linux
|
||||||
|
needs: build
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Setup .NET
|
||||||
|
uses: actions/setup-dotnet@v3
|
||||||
|
with:
|
||||||
|
dotnet-version: 10.0.x
|
||||||
|
- name: Setup GitVersion
|
||||||
|
uses: gittools/actions/gitversion/setup@v4.2.0
|
||||||
|
with:
|
||||||
|
versionSpec: 6.4.x
|
||||||
|
- name: Determine version
|
||||||
|
uses: gittools/actions/gitversion/execute@v4.2.0
|
||||||
|
id: gitversion
|
||||||
|
with:
|
||||||
|
configFilePath: ./.gitea/config/gitversion.yml
|
||||||
|
outputs:
|
||||||
|
version: ${{ steps.gitversion.outputs.SemVer }}
|
||||||
|
pack:
|
||||||
|
name: Pack
|
||||||
|
runs-on: linux
|
||||||
|
needs: version
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
- name: Setup .NET
|
||||||
|
uses: actions/setup-dotnet@v3
|
||||||
|
with:
|
||||||
|
dotnet-version: 10.0.x
|
||||||
|
- name: Add package source
|
||||||
|
run: dotnet nuget add source --name gitea --username TimetableDesigner --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text https://repos.mateuszskoczek.com/api/packages/TimetableDesigner/nuget/index.json
|
||||||
|
- name: Create NuGet package
|
||||||
|
run: dotnet pack -c Release -p:Version=${{needs.version.outputs.version}} -p:PackageVersion=${{needs.version.outputs.version}} --output ./
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: nuget
|
||||||
|
path: ./TimetableDesigner.Backend.Events.Providers.RabbitMQ.${{needs.version.outputs.version}}.nupkg
|
||||||
|
outputs:
|
||||||
|
version: ${{needs.version.outputs.version}}
|
||||||
|
publish:
|
||||||
|
name: Publish
|
||||||
|
runs-on: linux
|
||||||
|
needs: pack
|
||||||
|
steps:
|
||||||
|
- name: Download artifact
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: nuget
|
||||||
|
path: ./
|
||||||
|
- name: Setup .NET
|
||||||
|
uses: actions/setup-dotnet@v3
|
||||||
|
with:
|
||||||
|
dotnet-version: 10.0.x
|
||||||
|
- name: Add package source
|
||||||
|
run: dotnet nuget add source --name gitea --username TimetableDesigner --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text https://repos.mateuszskoczek.com/api/packages/TimetableDesigner/nuget/index.json
|
||||||
|
- name: Publish
|
||||||
|
run: dotnet nuget push ./TimetableDesigner.Backend.Events.Providers.RabbitMQ.${{needs.pack.outputs.version}}.nupkg --source gitea --api-key ${{ secrets.PACKAGES_WRITE_TOKEN }} --skip-duplicate
|
||||||
|
- name: Create Release
|
||||||
|
uses: akkuman/gitea-release-action@v1
|
||||||
|
with:
|
||||||
|
tag_name: ${{needs.pack.outputs.version}}
|
||||||
|
name: ${{needs.pack.outputs.version}}
|
||||||
|
files: |-
|
||||||
|
TimetableDesigner.Backend.Events.Providers.RabbitMQ.${{needs.pack.outputs.version}}.nupkg
|
||||||
24
.github/workflows/pull_request_dev.yml
vendored
24
.github/workflows/pull_request_dev.yml
vendored
@@ -1,24 +0,0 @@
|
|||||||
name: Build NuGet package on dev branch pull request
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- "dev"
|
|
||||||
paths:
|
|
||||||
- "TimetableDesigner.Backend.Events.Providers.RabbitMQ**"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v6.0.2
|
|
||||||
- name: Setup .NET
|
|
||||||
uses: actions/setup-dotnet@v3
|
|
||||||
with:
|
|
||||||
dotnet-version: 10.0.x
|
|
||||||
- name: Add source
|
|
||||||
run: dotnet nuget add source --username TimetableDesigner --password ${{secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/TimetableDesigner/index.json"
|
|
||||||
- name: Build
|
|
||||||
run: dotnet build
|
|
||||||
24
.github/workflows/pull_request_main.yml
vendored
24
.github/workflows/pull_request_main.yml
vendored
@@ -1,24 +0,0 @@
|
|||||||
name: Build NuGet package on main branch pull request
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- "main"
|
|
||||||
paths:
|
|
||||||
- "TimetableDesigner.Backend.Events.Providers.RabbitMQ**"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v6.0.2
|
|
||||||
- name: Setup .NET
|
|
||||||
uses: actions/setup-dotnet@v3
|
|
||||||
with:
|
|
||||||
dotnet-version: 10.0.x
|
|
||||||
- name: Add source
|
|
||||||
run: dotnet nuget add source --username TimetableDesigner --password ${{secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/TimetableDesigner/index.json"
|
|
||||||
- name: Build
|
|
||||||
run: dotnet build
|
|
||||||
24
.github/workflows/push_dev.yml
vendored
24
.github/workflows/push_dev.yml
vendored
@@ -1,24 +0,0 @@
|
|||||||
name: Build NuGet package on dev branch push
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- "dev"
|
|
||||||
paths:
|
|
||||||
- "TimetableDesigner.Backend.Events.Providers.RabbitMQ**"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v6.0.2
|
|
||||||
- name: Setup .NET
|
|
||||||
uses: actions/setup-dotnet@v3
|
|
||||||
with:
|
|
||||||
dotnet-version: 10.0.x
|
|
||||||
- name: Add source
|
|
||||||
run: dotnet nuget add source --username TimetableDesigner --password ${{secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/TimetableDesigner/index.json"
|
|
||||||
- name: Build
|
|
||||||
run: dotnet build
|
|
||||||
74
.github/workflows/push_main.yml
vendored
74
.github/workflows/push_main.yml
vendored
@@ -1,74 +0,0 @@
|
|||||||
name: Build NuGet package on main branch push
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- "main"
|
|
||||||
paths:
|
|
||||||
- "TimetableDesigner.Backend.Events.Providers.RabbitMQ**"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Build and pack
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v6.0.2
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: Setup .NET
|
|
||||||
uses: actions/setup-dotnet@v3
|
|
||||||
with:
|
|
||||||
dotnet-version: 10.0.x
|
|
||||||
- name: Add source
|
|
||||||
run: dotnet nuget add source --username TimetableDesigner --password ${{secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/TimetableDesigner/index.json"
|
|
||||||
- name: Build
|
|
||||||
run: dotnet build
|
|
||||||
- name: Setup GitVersion
|
|
||||||
uses: gittools/actions/gitversion/setup@v4.2.0
|
|
||||||
with:
|
|
||||||
versionSpec: 6.4.x
|
|
||||||
- name: Determine version
|
|
||||||
uses: gittools/actions/gitversion/execute@v4.2.0
|
|
||||||
id: gitversion
|
|
||||||
with:
|
|
||||||
configFilePath: ./.github/config/gitversion.yml
|
|
||||||
- name: Create NuGet package
|
|
||||||
run: dotnet pack -c Release -p:Version=${{steps.gitversion.outputs.SemVer}} -p:PackageVersion=${{steps.gitversion.outputs.SemVer}} --output ${{ github.workspace}}/nuget
|
|
||||||
- name: Upload artifact
|
|
||||||
uses: actions/upload-artifact@v6
|
|
||||||
with:
|
|
||||||
name: nuget
|
|
||||||
path: ${{ github.workspace}}/nuget/*.nupkg
|
|
||||||
outputs:
|
|
||||||
version: ${{ steps.gitversion.outputs.SemVer }}
|
|
||||||
publish:
|
|
||||||
name: Publish
|
|
||||||
permissions: write-all
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: build
|
|
||||||
steps:
|
|
||||||
- name: Download artifact
|
|
||||||
uses: actions/download-artifact@v6
|
|
||||||
with:
|
|
||||||
name: nuget
|
|
||||||
path: ${{ github.workspace}}/nuget
|
|
||||||
- name: Setup .NET
|
|
||||||
uses: actions/setup-dotnet@v3
|
|
||||||
with:
|
|
||||||
dotnet-version: 10.0.x
|
|
||||||
- name: Add source
|
|
||||||
run: dotnet nuget add source --username TimetableDesigner --password ${{secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/TimetableDesigner/index.json"
|
|
||||||
- name: Publish
|
|
||||||
run: dotnet nuget push ${{ github.workspace}}/nuget/*.nupkg --source "github" --api-key ${{ secrets.NUGET_REGISTRY_API_KEY }} --skip-duplicate
|
|
||||||
- name: Create Release
|
|
||||||
uses: actions/create-release@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
tag_name: ${{needs.build.outputs.version}}
|
|
||||||
release_name: ${{needs.build.outputs.version}}
|
|
||||||
draft: false
|
|
||||||
prerelease: false
|
|
||||||
|
|
||||||
|
|
||||||
91
README.md
Normal file
91
README.md
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
<p align="center"><img width="100px" src=".gitea/readme/icon.png"/></p>
|
||||||
|
|
||||||
|
<h1 align="center">TimetableDesigner.Backend.Events.Providers.RabbitMQ</h1>
|
||||||
|
|
||||||
|
<h3 align="center"><b>Advanced school timetable editor, allows you to easily create and manage school timetable.</b></h3>
|
||||||
|
|
||||||
|
<p align="center">TimetableDesigner.Backend.Events is collection of NuGet packages (and NuGet package itself) that support communication between microservices in the TimetableDesigner project using message queues. This NuGet package contains implementation for RabbitMQ message queue provider.</p>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Informations
|
||||||
|
|
||||||
|
> [!Important]
|
||||||
|
> **For Github users:**
|
||||||
|
>
|
||||||
|
> This is only mirror repository. All changes are first uploaded to the repository <a href="https://repos.mateuszskoczek.com/TimetableDesigner/TimetableDesigner.Backend.Events.Providers.RabbitMQ">here</a>. Releases are also published on original repository. However, Github repository handles issues and pull requests for better accessibility.
|
||||||
|
|
||||||
|
## NuGet registry status
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
Subpackage
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
Status
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<b>TimetableDesigner.Backend.Events.Providers.RabbitMQ</b>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://repos.mateuszskoczek.com/TimetableDesigner/-/packages/nuget/timetabledesigner.backend.events.providers.rabbitmq/"><img src="https://img.shields.io/gitea/v/release/TimetableDesigner/TimetableDesigner.Backend.Events.Providers.RabbitMQ?gitea_url=https%3A%2F%2Frepos.mateuszskoczek.com%2F&display_name=release&label=nuget"></a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th colspan=2>
|
||||||
|
Other subpackages
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
TimetableDesigner.Backend.Events
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://repos.mateuszskoczek.com/TimetableDesigner/-/packages/nuget/timetabledesigner.backend.events/"><img src="https://img.shields.io/gitea/v/release/TimetableDesigner/TimetableDesigner.Backend.Events?gitea_url=https%3A%2F%2Frepos.mateuszskoczek.com%2F&display_name=release&label=nuget"></a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
TimetableDesigner.Backend.Events.OutboxPattern
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://repos.mateuszskoczek.com/TimetableDesigner/-/packages/nuget/timetabledesigner.backend.events.outboxpattern/"><img src="https://img.shields.io/gitea/v/release/TimetableDesigner/TimetableDesigner.Backend.Events.OutboxPattern?gitea_url=https%3A%2F%2Frepos.mateuszskoczek.com%2F&display_name=release&label=nuget"></a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
TimetableDesigner.Backend.Events.Extensions.AspNetCore.OpenApi
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://repos.mateuszskoczek.com/TimetableDesigner/-/packages/nuget/timetabledesigner.backend.events.extensions.aspnetcore.openapi/"><img src="https://img.shields.io/gitea/v/release/TimetableDesigner/TimetableDesigner.Backend.Events.Extensions.AspNetCore.OpenApi?gitea_url=https%3A%2F%2Frepos.mateuszskoczek.com%2F&display_name=release&label=nuget"></a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
## Installation and usage
|
||||||
|
|
||||||
|
You can download package from organization package registry or .nupkg file itself from Releases tab.
|
||||||
|
|
||||||
|
To download package from organization package registry, you have to add new NuGet package source. You will need access details, which you can obtain by contacting the repository owner.
|
||||||
|
|
||||||
|
**CLI:**
|
||||||
|
|
||||||
|
```
|
||||||
|
dotnet nuget add source --name TimetableDesigner --username <username> --password <password> https://repos.mateuszskoczek.com/api/packages/TimetableDesigner/nuget/index.json
|
||||||
|
dotnet add package --source TimetableDesigner TimetableDesigner.Backend.Events.Providers.RabbitMQ
|
||||||
|
```
|
||||||
|
|
||||||
|
**Package reference in .csproj file:**
|
||||||
|
|
||||||
|
```
|
||||||
|
<PackageReference Include="TimetableDesigner.Backend.Events.Providers.RabbitMQ" Version="<version>" />
|
||||||
|
```
|
||||||
|
|
||||||
|
## Attribution and contribution
|
||||||
|
|
||||||
|
This project is open source on MIT License, so you can just copy and upload again to your repository. But according to the license, you must include information about the original author. You can find license <a href="https://repos.mateuszskoczek.com/TimetableDesigner/TimetableDesigner.Backend.Events.Providers.RabbitMQ/src/branch/main/LICENSE">here</a>.
|
||||||
|
|
||||||
|
However, the preferred way to contribute would be to propose improvements in a pull request, through issues, or through other means of communication.
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
# TimetableDesigner.Backend.Events.Providers.RabbitMQ
|
||||||
|
|
||||||
|
### Advanced school timetable editor, allows you to easily create and manage school timetable.
|
||||||
|
|
||||||
|
TimetableDesigner.Backend.Events is collection of NuGet packages (and NuGet package itself) that support communication between microservices in the TimetableDesigner project using message queues. This NuGet package contains implementation for RabbitMQ message queue provider.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## NuGet registry status
|
||||||
|
|
||||||
|
| Subpackage | Status |
|
||||||
|
|----------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
|
| **TimetableDesigner.Backend.Events.Providers.RabbitMQ** | [](https://repos.mateuszskoczek.com/TimetableDesigner/-/packages/nuget/timetabledesigner.backend.events.providers.rabbitmq/) |
|
||||||
|
| TimetableDesigner.Backend.Events | [](https://repos.mateuszskoczek.com/TimetableDesigner/-/packages/nuget/timetabledesigner.backend.events/) |
|
||||||
|
| TimetableDesigner.Backend.Events.OutboxPattern | [](https://repos.mateuszskoczek.com/TimetableDesigner/-/packages/nuget/timetabledesigner.backend.events.outboxpattern/) |
|
||||||
|
| TimetableDesigner.Backend.Events.Extensions.AspNetCore.OpenApi | [](https://repos.mateuszskoczek.com/TimetableDesigner/-/packages/nuget/timetabledesigner.backend.events.extensions.aspnetcore.openapi/) |
|
||||||
|
|
||||||
|
## Installation and usage
|
||||||
|
|
||||||
|
You can download package from organization package registry or .nupkg file itself from Releases tab.
|
||||||
|
|
||||||
|
To download package from organization package registry, you have to add new NuGet package source. You will need access details, which you can obtain by contacting the repository owner.
|
||||||
|
|
||||||
|
**CLI:**
|
||||||
|
|
||||||
|
```
|
||||||
|
dotnet nuget add source --name TimetableDesigner --username <username> --password <password> https://repos.mateuszskoczek.com/api/packages/TimetableDesigner/nuget/index.json
|
||||||
|
dotnet add package --source TimetableDesigner TimetableDesigner.Backend.Events.Providers.RabbitMQ
|
||||||
|
```
|
||||||
|
|
||||||
|
**Package reference in .csproj file:**
|
||||||
|
|
||||||
|
```
|
||||||
|
<PackageReference Include="TimetableDesigner.Backend.Events.Providers.RabbitMQ" Version="<version>" />
|
||||||
|
```
|
||||||
|
|
||||||
|
## Attribution and contribution
|
||||||
|
|
||||||
|
This project is open source on MIT License, so you can just copy and upload again to your repository. But according to the license, you must include information about the original author. You can find license <a href="https://repos.mateuszskoczek.com/TimetableDesigner/TimetableDesigner.Backend.Events.Providers.RabbitMQ/src/branch/main/LICENSE">here</a>.
|
||||||
|
|
||||||
|
However, the preferred way to contribute would be to propose improvements in a pull request, through issues, or through other means of communication.
|
||||||
@@ -3,29 +3,36 @@ using RabbitMQ.Client;
|
|||||||
|
|
||||||
namespace TimetableDesigner.Backend.Events.Providers.RabbitMQ;
|
namespace TimetableDesigner.Backend.Events.Providers.RabbitMQ;
|
||||||
|
|
||||||
public class RabbitMQEventQueue : EventQueue
|
public class RabbitMQEventQueue : EventQueue<RabbitMQEventQueue>
|
||||||
{
|
{
|
||||||
public string Hostname { get; set; } = null!;
|
|
||||||
public int Port { get; set; }
|
|
||||||
public string Username { get; set; } = null!;
|
|
||||||
public string Password { get; set; } = null!;
|
|
||||||
public string ExchangeName { get; set; } = null!;
|
|
||||||
public string QueuePrefix { get; set; } = null!;
|
|
||||||
|
|
||||||
public override void Setup(IServiceCollection services)
|
protected override void Setup(IServiceCollection services, IDictionary<string, string> connectionParameters)
|
||||||
{
|
{
|
||||||
|
if (!connectionParameters.TryGetValue("Hostname", out string hostname))
|
||||||
|
{
|
||||||
|
hostname = "localhost";
|
||||||
|
}
|
||||||
|
if (!connectionParameters.TryGetValue("Port", out string port))
|
||||||
|
{
|
||||||
|
port = "5672";
|
||||||
|
}
|
||||||
|
string username = connectionParameters["Username"];
|
||||||
|
string password = connectionParameters["Password"];
|
||||||
|
string exchangeName = connectionParameters["ExchangeName"];
|
||||||
|
string queuePrefix = connectionParameters["QueuePrefix"];
|
||||||
|
|
||||||
ConnectionFactory factory = new ConnectionFactory
|
ConnectionFactory factory = new ConnectionFactory
|
||||||
{
|
{
|
||||||
HostName = Hostname,
|
HostName = hostname,
|
||||||
Port = Port,
|
Port = int.Parse(port),
|
||||||
UserName = Username,
|
UserName = username,
|
||||||
Password = Password,
|
Password = password,
|
||||||
};
|
};
|
||||||
|
|
||||||
Task<IConnection> createConnectionTask = factory.CreateConnectionAsync();
|
Task<IConnection> createConnectionTask = factory.CreateConnectionAsync();
|
||||||
createConnectionTask.Wait();
|
createConnectionTask.Wait();
|
||||||
services.AddSingleton(createConnectionTask.Result);
|
services.AddSingleton(createConnectionTask.Result);
|
||||||
services.AddSingleton<IEventQueuePublisher, RabbitMQEventQueuePublisher>(sp => new RabbitMQEventQueuePublisher(sp.GetRequiredService<IConnection>(), ExchangeName));
|
services.AddSingleton<IEventQueuePublisher, RabbitMQEventQueuePublisher>(sp => new RabbitMQEventQueuePublisher(sp.GetRequiredService<IConnection>(), exchangeName));
|
||||||
services.AddSingleton<IEventQueueSubscriber, RabbitMQEventQueueSubscriber>(sp => new RabbitMQEventQueueSubscriber(sp.GetRequiredService<IConnection>(), ExchangeName, QueuePrefix));
|
services.AddSingleton<IEventQueueSubscriber, RabbitMQEventQueueSubscriber>(sp => new RabbitMQEventQueueSubscriber(sp.GetRequiredService<IConnection>(), exchangeName, queuePrefix));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
namespace TimetableDesigner.Backend.Events.Providers.RabbitMQ;
|
||||||
|
|
||||||
|
public class RabbitMQEventQueueBuilder : EventQueueBuilder<RabbitMQEventQueue>
|
||||||
|
{
|
||||||
|
public string Hostname { get; set; } = "localhost";
|
||||||
|
public int Port { get; set; } = 5672;
|
||||||
|
public string Username { get; set; } = null!;
|
||||||
|
public string Password { get; set; } = null!;
|
||||||
|
public string ExchangeName { get; set; } = null!;
|
||||||
|
public string QueuePrefix { get; set; } = null!;
|
||||||
|
|
||||||
|
public override IDictionary<string, string> GetConnectionParameters() => new Dictionary<string, string>()
|
||||||
|
{
|
||||||
|
{ nameof(Hostname), Hostname },
|
||||||
|
{ nameof(Port), Port.ToString() },
|
||||||
|
{ nameof(Username), Username },
|
||||||
|
{ nameof(Password), Password },
|
||||||
|
{ nameof(ExchangeName), ExchangeName },
|
||||||
|
{ nameof(QueuePrefix), QueuePrefix }
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -14,21 +14,19 @@ public class RabbitMQEventQueuePublisher : IEventQueuePublisher
|
|||||||
_exchangeName = exchangeName;
|
_exchangeName = exchangeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task PublishAsync<T>(T eventData) where T : class
|
public async Task PublishAsync(string data, Type dataType)
|
||||||
{
|
{
|
||||||
string routingKey = typeof(T).FullName!;
|
|
||||||
BasicProperties properties = new BasicProperties
|
BasicProperties properties = new BasicProperties
|
||||||
{
|
{
|
||||||
ContentType = "application/json",
|
ContentType = "application/json",
|
||||||
DeliveryMode = DeliveryModes.Persistent,
|
DeliveryMode = DeliveryModes.Persistent,
|
||||||
Type = typeof(T).FullName,
|
Type = dataType.FullName,
|
||||||
|
|
||||||
};
|
};
|
||||||
ReadOnlyMemory<byte> body = JsonSerializer.SerializeToUtf8Bytes(eventData);
|
ReadOnlyMemory<byte> body = JsonSerializer.SerializeToUtf8Bytes(data);
|
||||||
await using (IChannel channel = await _connection.CreateChannelAsync())
|
await using (IChannel channel = await _connection.CreateChannelAsync())
|
||||||
{
|
{
|
||||||
await channel.ExchangeDeclareAsync(_exchangeName, ExchangeType.Direct);
|
await channel.ExchangeDeclareAsync(_exchangeName, ExchangeType.Direct);
|
||||||
await channel.BasicPublishAsync(_exchangeName, routingKey, true, properties, body);
|
await channel.BasicPublishAsync(_exchangeName, dataType.FullName!, true, properties, body);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,17 +4,20 @@
|
|||||||
<TargetFramework>net10.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<Version />
|
|
||||||
<Title>TimetableDesigner.Backend.Events.Providers.RabbitMQ</Title>
|
<Title>TimetableDesigner.Backend.Events.Providers.RabbitMQ</Title>
|
||||||
<Authors>Mateusz Skoczek</Authors>
|
<Authors>Mateusz Skoczek</Authors>
|
||||||
<PackageProjectUrl>https://github.com/TimetableDesigner/TimetableDesigner.Backend.Events.Providers.RabbitMQ</PackageProjectUrl>
|
<PackageProjectUrl>https://repos.mateuszskoczek.com/TimetableDesigner</PackageProjectUrl>
|
||||||
<PackageIcon>icon.png</PackageIcon>
|
<PackageIcon>icon.png</PackageIcon>
|
||||||
<RepositoryUrl>https://github.com/TimetableDesigner/TimetableDesigner.Backend.Events.Providers.RabbitMQ</RepositoryUrl>
|
<RepositoryUrl>https://repos.mateuszskoczek.com/TimetableDesigner/TimetableDesigner.Backend.Events.Providers.RabbitMQ</RepositoryUrl>
|
||||||
|
<Copyright>Mateusz Skoczek</Copyright>
|
||||||
|
<PackageLicenseUrl>https://repos.mateuszskoczek.com/TimetableDesigner/TimetableDesigner.Backend.Events.Providers.RabbitMQ/src/branch/main/LICENSE</PackageLicenseUrl>
|
||||||
|
<Description>Advanced school timetable editor, allows you to easily create and manage school timetable - package that support communication between microservices in the project using message queues (implementations for RabbitMQ)</Description>
|
||||||
|
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="RabbitMQ.Client" Version="7.2.0" />
|
<PackageReference Include="RabbitMQ.Client" Version="7.2.0" />
|
||||||
<PackageReference Include="timetabledesigner.backend.events" Version="1.1.1" />
|
<PackageReference Include="timetabledesigner.backend.events" Version="1.1.7" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -22,5 +25,9 @@
|
|||||||
<Pack>True</Pack>
|
<Pack>True</Pack>
|
||||||
<PackagePath></PackagePath>
|
<PackagePath></PackagePath>
|
||||||
</None>
|
</None>
|
||||||
|
<None Update="README.md">
|
||||||
|
<Pack>True</Pack>
|
||||||
|
<PackagePath></PackagePath>
|
||||||
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Reference in New Issue
Block a user