Dispatch Notification Suite.
- Go to releases
- Download latest version of
dispatch/api/v*.7z
- Extract contents of
DispatchApi-v*.7z
- Convert extracted folder to Application in IIS (Target framework: .NET 4.5)
- Application Pool Advanced Settings: set "Start Mode" = "AlwaysRunning"
- Web Site Advanced Settings: set "Preload Enabled" = "True"
The only mandatory configuration is setting available storage option via JobStorageName
in application settings:
<applicationSettings>
<Apexnet.Dispatch.Api.Properties.Settings>
<setting name="JobStorageName" serializeAs="String">
<value>hangfire-memory</value>
</setting>
</Apexnet.Dispatch.Api.Properties.Settings>
</applicationSettings>
Available values for JobStorageName
are: hangfire-redis
or hangfire-memory
.
No configuration is necessary.
Complete definition for redisStorage
is:
<HangfireStorage xmlns="urn:Apexnet.JobQueue.Configuration">
<redisStorage connectionString="{HANGFIRE_STORAGE_REDIS_CONNECTION}">
<redisStorageOptions db="..." invisibilityTimeout="..." prefix="..."/>
</redisStorage>
</HangfireStorage>
ℹ️
{HANGFIRE_STORAGE_REDIS_CONNECTION}
is an utility placeholder that you could replace, for instance, using an automated script to configure various installations in a continuous integration server.
Setting | Description |
---|---|
connectionString |
the only mandatory configuration. Read official documentation for a complete list of connection string formats. |
redisStorageOptions |
can be omitted entirely if you don't intend to customize none of db , invisibilityTimeout , or prefix attributes. In fact default Web.config doesn't include this section for this reason. |
db |
redis db number (default: 0 ). |
invisibilityTimeout |
a time span value (default: 30 minutes). |
prefix |
unique redis environment prefix (default: hangfire: ) |
Configure smtp
settings only if you intend to send e-mail notifications using hermes:
<mailSettings>
<smtp from="{SMTP_FROM}">
<network defaultCredentials="false" host="{SMTP_HOST}" port="{SMTP_PORT}" userName="{SMTP_USERNAME}" password="{SMTP_PASSWORD}" enableSsl="{SMTP_SSL}"/>
</smtp>
</mailSettings>
ℹ️
{SMTP_*}
are utility placeholders that you could replace, for instance, using an automated script to configure various installations in a continuous integration server.
Read MSDN for a complete definition of this configuration setting.
Configure apexnetPushServiceReference
settings only if you intend to send push notifications using Apex-net proprietary push notification service. (Installed and configured separately:)
<ApexnetPushService xmlns="urn:Apexnet.Messaging.Configuration">
<apexnetPushServiceReference url="{APEXNET_PUSH_SERVICE_URL}" />
</ApexnetPushService>
ℹ️
{APEXNET_PUSH_SERVICE_URL}
is an utility placeholder that you could replace, for instance, using an automated script to configure various installations in a continuous integration server.
Setting | Description |
---|---|
url |
the only mandatory configuration that is the base URL for Apex-net Push Notification REST APIs |
Given <Base URI>
(e.g., http://example.com/hermes
) where you configured IIS to serve Hermes server, default Hangfire dashboard should appear at <Base URI>/jobs
.
Make sure;
- replacing
you@example.com
below with a valid e-mail address - replacing
<Base URI>
with where you configured IIS to serve Hermes server Accept: application/vnd.dispatch+json; version=<version>
contains correct server version
curl -X "POST" "<Base URI>/api/schedule" \
-H "Accept: application/vnd.dispatch+json; version=<version>" \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'
{
"Schedule": "2000-01-01T00:00:00.0000000+00:00",
"MailMessages": [
{
"From": {
"Address": "hermes@example.com",
"DisplayName": "Hermes Almighty"
},
"To": [
{
"Address": "you@example.com",
"DisplayName": "What\'s your name?"
}
],
"Subject": "Aloha",
"Body": "It works!",
"IsBodyHtml": false
}
]
}'
Make sure;
- replacing
<Base URI>
with where you configured IIS to serve Hermes server - replacing
<HTTP request>
with the URI of your http request - see CRON expressions for scheduling details (and some examples)
Accept: application/vnd.dispatch+json; version=<version>
contains correct server version
curl -X "POST" "<Base URI>/api/recur" \
-H "Accept: application/vnd.dispatch+json; version=<version>" \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'
{
"CronExpression": "*/2 * * * *",
"HttpRequests": [
{
"Method": "HEAD",
"RequestUri": "<HTTP request>"
}
]
}'
⚠️ This feature requires you have access to Apex-net proprietary push notification service!
Make sure;
- replacing
<Authentication key>
,<Application key>
and<Username>
below with a valid values - replacing
<Base URI>
with where you configured IIS to serve Hermes server Accept: application/vnd.dispatch+json; version=<version>
contains correct server version
curl -X "POST" "<Base URI>/api/schedule" \
-H 'Accept: application/vnd.dispatch+json; version=<version>' \
-H 'Content-Type: application/json; charset=utf-8' \
-d '
{
"Schedule":"2000-01-01T00:00:00.0000000+00:00",
"ApexnetPushNotifications":[
{
"AuthKey":"<Authentication key>",
"AppKey":"<Application key>",
"UserName":"<Username>",
"Message":"If enabled, badge number should be 1. Have a nice day!",
"BadgeCount":1
}
]
}'
- Install NuGet
- Install Apexnet.Dispatch.Api.Client via NuGet
For example usages check out these tests.