-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
53 additions
and
38 deletions.
There are no files selected for viewing
42 changes: 20 additions & 22 deletions
42
HangFire.TopicExtensions/Attributes/SubscriberJobAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,34 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Hangfire.States; | ||
|
||
namespace HangFire.TopicExtensions.Attributes | ||
{ | ||
[AttributeUsage(AttributeTargets.Class)] | ||
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] | ||
public class SubscriberJobAttribute : Attribute | ||
{ | ||
public SubscriberJobAttribute(string topic) : this(topic, EnqueuedState.DefaultQueue) | ||
{ | ||
} | ||
|
||
public string TopicJobId { get; set; } | ||
|
||
public string Queue { get; set; } | ||
|
||
|
||
public bool Enabled { get; set; } = true; | ||
|
||
public SubscriberJobAttribute(string topic) : this(topic, EnqueuedState.DefaultQueue) { } | ||
public SubscriberJobAttribute(string topic, string queue) | ||
{ | ||
if (string.IsNullOrEmpty(topic)) throw new ArgumentNullException(nameof(topic)); | ||
|
||
|
||
|
||
public SubscriberJobAttribute(string topic, string queue) | ||
{ | ||
if (string.IsNullOrEmpty(topic)) throw new ArgumentNullException(nameof(topic)); | ||
|
||
if (string.IsNullOrEmpty(queue)) throw new ArgumentNullException(nameof(queue)); | ||
if (string.IsNullOrEmpty(queue)) throw new ArgumentNullException(nameof(queue)); | ||
|
||
|
||
Topic = topic; | ||
Queue = queue; | ||
} | ||
|
||
Topic = topic; | ||
Queue = queue; | ||
} | ||
|
||
public string TopicJobId { get; set; } | ||
|
||
public string Queue { get; set; } | ||
|
||
|
||
public bool Enabled { get; set; } = true; | ||
|
||
public string Topic { get; set; } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters