Skip to content
Browse files

moved oneway bus

  • Loading branch information...
1 parent 4034f2f commit 54743e660bbde0885fa9cf9af4ee52d52b9975ec mnichols committed Jul 5, 2010
View
4 Rhino.ServiceBus.Tests/Bugs/FIeldProblem_Nick.cs
@@ -40,7 +40,7 @@ public static class SubscriptionTest
subscriptionStorage.HandleAdministrativeMessage;
Message msg = new MsmqMessageBuilder
- (serializer).GenerateMsmqMessageFromMessageBatch(new
+ (serializer).BuildFromMessageBatch(new
AddInstanceSubscription
{
Endpoint = queueEndpoint.Uri.ToString(),
@@ -52,7 +52,7 @@ public static class SubscriptionTest
wait.WaitOne();
msg = new MsmqMessageBuilder
- (serializer).GenerateMsmqMessageFromMessageBatch(new
+ (serializer).BuildFromMessageBatch(new
RemoveInstanceSubscription
{
Endpoint = queueEndpoint.Uri.ToString(),
View
4 Rhino.ServiceBus/IMessageBuilder.cs
@@ -2,8 +2,8 @@
namespace Rhino.ServiceBus
{
- public interface IMessageBuilder
+ public interface IMessageBuilder<T>
{
- Message GenerateMsmqMessageFromMessageBatch(params object[] msgs);
+ T BuildFromMessageBatch(params object[] msgs);
}
}
View
2 Rhino.ServiceBus/Msmq/AbstractMsmqListener.cs
@@ -273,7 +273,7 @@ protected static void Raise(Action action)
protected Message GenerateMsmqMessageFromMessageBatch(params object[] msgs)
{
- return builder.GenerateMsmqMessageFromMessageBatch(msgs);
+ return builder.BuildFromMessageBatch(msgs);
}
protected object[] DeserializeMessages(OpenedQueue messageQueue, Message transportMessage, Action<CurrentMessageInformation, Exception> messageSerializationException)
View
4 Rhino.ServiceBus/Msmq/MsmqMessageBuilder.cs
@@ -8,7 +8,7 @@
namespace Rhino.ServiceBus.Msmq
{
- public class MsmqMessageBuilder : IMessageBuilder
+ public class MsmqMessageBuilder : IMessageBuilder<Message>
{
private readonly ILog logger = LogManager.GetLogger(typeof (MsmqMessageBuilder));
private readonly IMessageSerializer messageSerializer;
@@ -25,7 +25,7 @@ public MsmqMessageBuilder(IMessageSerializer messageSerializer, Endpoint endpoin
this.endpoint = endpoint;
}
- public Message GenerateMsmqMessageFromMessageBatch(params object[] msgs)
+ public Message BuildFromMessageBatch(params object[] msgs)
{
var message = new Message();
View
51 Rhino.ServiceBus/Impl/OnewayBus.cs → Rhino.ServiceBus/Msmq/OnewayBus.cs
@@ -1,26 +1,27 @@
-using Rhino.ServiceBus.Msmq;
-
-namespace Rhino.ServiceBus.Impl
-{
- public class OnewayBus : IOnewayBus
- {
- private readonly MessageOwnersSelector messageOwners;
- private readonly IMessageBuilder messageBuilder;
-
- public OnewayBus(MessageOwner[] messageOwners, IMessageBuilder messageBuilder)
- {
- this.messageOwners = new MessageOwnersSelector(messageOwners, new EndpointRouter());
- this.messageBuilder = messageBuilder;
- }
-
- public void Send(params object[] msgs)
- {
- var endpoint = messageOwners.GetEndpointForMessageBatch(msgs);
- using(var queue = endpoint.InitalizeQueue())
- {
- var message = messageBuilder.GenerateMsmqMessageFromMessageBatch(msgs);
- queue.SendInSingleTransaction(message);
- }
- }
- }
+using System.Messaging;
+using Rhino.ServiceBus.Msmq;
+
+namespace Rhino.ServiceBus.Impl
+{
+ public class OnewayBus : IOnewayBus
+ {
+ private readonly MessageOwnersSelector messageOwners;
+ private readonly IMessageBuilder messageBuilder;
+
+ public OnewayBus(MessageOwner[] messageOwners, IMessageBuilder messageBuilder)
+ {
+ this.messageOwners = new MessageOwnersSelector(messageOwners, new EndpointRouter());
+ this.messageBuilder = messageBuilder;
+ }
+
+ public void Send(params object[] msgs)
+ {
+ var endpoint = messageOwners.GetEndpointForMessageBatch(msgs);
+ using(var queue = endpoint.InitalizeQueue())
+ {
+ var message = messageBuilder.BuildFromMessageBatch<Message>(msgs);
+ queue.SendInSingleTransaction(message);
+ }
+ }
+ }
}
View
3 Rhino.ServiceBus/Rhino.ServiceBus.csproj
@@ -119,6 +119,7 @@
<Compile Include="Messages\ReadyToWork.cs" />
<Compile Include="Msmq\AbstractMsmqListener.cs" />
<Compile Include="Msmq\QueueCreationModule.cs" />
+ <Compile Include="RhinoQueues\RhinoQueuesMessageBuilder.cs" />
<Compile Include="RhinoQueues\RhinoQueuesOneWayBus.cs" />
<Compile Include="Transport\SubQueue.cs" />
<Compile Include="Msmq\TransportActions\ShutDownAction.cs" />
@@ -197,7 +198,7 @@
<Compile Include="Impl\AbstractRhinoServiceBusFacility.cs" />
<Compile Include="Impl\MessageOwnersConfigReader.cs" />
<Compile Include="Impl\MessageOwnersSelector.cs" />
- <Compile Include="Impl\OnewayBus.cs" />
+ <Compile Include="Msmq\OnewayBus.cs" />
<Compile Include="Impl\OnewayRhinoServiceBusFacility.cs" />
<Compile Include="Impl\RijndaelEncryptionService.cs" />
<Compile Include="Internal\ICustomElementSerializer.cs" />
View
13 Rhino.ServiceBus/RhinoQueues/RhinoQueuesMessageBuilder.cs
@@ -0,0 +1,13 @@
+using System;
+using Rhino.Queues;
+
+namespace Rhino.ServiceBus.RhinoQueues
+{
+ public class RhinoQueuesMessageBuilder : IMessageBuilder<MessagePayload>
+ {
+ public MessagePayload BuildFromMessageBatch(params object[] msgs)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}

0 comments on commit 54743e6

Please sign in to comment.
Something went wrong with that request. Please try again.