-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
State Machine Activities for Kafka Topic Producer and Event Hub Producer
- Loading branch information
Showing
24 changed files
with
1,134 additions
and
97 deletions.
There are no files selected for viewing
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
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
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
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
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
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
13 changes: 4 additions & 9 deletions
13
src/MassTransit/Automatonymous/DefaultConstructorStateMachineActivityFactory.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,21 +1,16 @@ | ||
namespace Automatonymous | ||
{ | ||
using System; | ||
using GreenPipes; | ||
|
||
|
||
public class DefaultConstructorStateMachineActivityFactory : | ||
IStateMachineActivityFactory | ||
{ | ||
public Activity<TInstance, TData> GetActivity<TActivity, TInstance, TData>(BehaviorContext<TInstance, TData> context) | ||
where TActivity : class, Activity<TInstance, TData> | ||
public T GetService<T>(PipeContext context) | ||
where T : class | ||
{ | ||
return (Activity<TInstance, TData>)Activator.CreateInstance(typeof(TActivity)); | ||
} | ||
|
||
public Activity<TInstance> GetActivity<TActivity, TInstance>(BehaviorContext<TInstance> context) | ||
where TActivity : class, Activity<TInstance> | ||
{ | ||
return (Activity<TInstance>)Activator.CreateInstance(typeof(TActivity)); | ||
return Activator.CreateInstance<T>(); | ||
} | ||
} | ||
} |
24 changes: 7 additions & 17 deletions
24
src/MassTransit/Automatonymous/IStateMachineActivityFactory.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,26 +1,16 @@ | ||
namespace Automatonymous | ||
{ | ||
using GreenPipes; | ||
|
||
|
||
public interface IStateMachineActivityFactory | ||
{ | ||
/// <summary> | ||
/// Creates a state machine activity for the specified context | ||
/// </summary> | ||
/// <typeparam name="TActivity"></typeparam> | ||
/// <typeparam name="TInstance"></typeparam> | ||
/// <typeparam name="TData"></typeparam> | ||
/// <param name="context"></param> | ||
/// <returns></returns> | ||
Activity<TInstance, TData> GetActivity<TActivity, TInstance, TData>(BehaviorContext<TInstance, TData> context) | ||
where TActivity : class, Activity<TInstance, TData>; | ||
|
||
/// <summary> | ||
/// Creates a state machine activity for the specified context | ||
/// Returns the service, if available, otherwise returns null | ||
/// </summary> | ||
/// <typeparam name="TActivity"></typeparam> | ||
/// <typeparam name="TInstance"></typeparam> | ||
/// <param name="context"></param> | ||
/// <typeparam name="T"></typeparam> | ||
/// <returns></returns> | ||
Activity<TInstance> GetActivity<TActivity, TInstance>(BehaviorContext<TInstance> context) | ||
where TActivity : class, Activity<TInstance>; | ||
T GetService<T>(PipeContext context) | ||
where T : class; | ||
} | ||
} |
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
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
namespace MassTransit | ||
{ | ||
using System; | ||
using System.Runtime.Serialization; | ||
|
||
|
||
[Serializable] | ||
public class ProduceException : | ||
MassTransitException | ||
{ | ||
public ProduceException() | ||
{ | ||
} | ||
|
||
public ProduceException(string message) | ||
: base(message) | ||
{ | ||
} | ||
|
||
public ProduceException(string message, Exception innerException) | ||
: base(message, innerException) | ||
{ | ||
} | ||
|
||
protected ProduceException(SerializationInfo info, StreamingContext context) | ||
: base(info, context) | ||
{ | ||
} | ||
} | ||
} |
Oops, something went wrong.