Permalink
Browse files

added detailed info about message (only id for now...)

  • Loading branch information...
1 parent f472995 commit c79aecf6937ad5026cb9f46974031db59676c852 @mookid8000 mookid8000 committed Mar 20, 2012
View
33 src/Rebus.Snoop/Events/MessageMoved.cs
@@ -0,0 +1,33 @@
+using Rebus.Snoop.ViewModel.Models;
+
+namespace Rebus.Snoop.Events
+{
+ public class MessageMoved
+ {
+ readonly Message messageThatWasMoved;
+ readonly string sourceQueuePath;
+ readonly string destinationQueuePath;
+
+ public MessageMoved(Message messageThatWasMoved, string sourceQueuePath, string destinationQueuePath)
+ {
+ this.messageThatWasMoved = messageThatWasMoved;
+ this.sourceQueuePath = sourceQueuePath;
+ this.destinationQueuePath = destinationQueuePath;
+ }
+
+ public Message MessageThatWasMoved
+ {
+ get { return messageThatWasMoved; }
+ }
+
+ public string SourceQueuePath
+ {
+ get { return sourceQueuePath; }
+ }
+
+ public string DestinationQueuePath
+ {
+ get { return destinationQueuePath; }
+ }
+ }
+}
View
14 src/Rebus.Snoop/Listeners/MsmqInteraction.cs
@@ -63,22 +63,22 @@ void MoveMessagesToSourceQueues(List<Message> messagesToMove)
return new NotificationEvent("{0} messages moved - {1} move operations failed",
result.Moved.Count, result.Failed.Count);
}
-
+
return new NotificationEvent("{0} messages moved", result.Moved.Count);
})
.ContinueWith(t => Messenger.Default.Send(t.Result), UiThread);
}
void MoveMessage(Message message)
{
+ var sourceQueuePath = message.QueuePath;
+ var destinationQueuePath = ToMessageQueuePath(message.Headers[Headers.SourceQueue]);
+
using(var transaction = new MessageQueueTransaction())
{
transaction.Begin();
try
{
- var sourceQueuePath = message.QueuePath;
- var destinationQueuePath = ToMessageQueuePath(message.Headers[Headers.SourceQueue]);
-
var sourceQueue = new MessageQueue(sourceQueuePath) {MessageReadPropertyFilter = DefaultFilter()};
var destinationQueue = new MessageQueue(destinationQueuePath);
@@ -93,6 +93,8 @@ void MoveMessage(Message message)
throw;
}
}
+
+ Messenger.Default.Send(new MessageMoved(message, sourceQueuePath, destinationQueuePath));
}
static string ToMessageQueuePath(string inputQueue)
@@ -119,7 +121,7 @@ void LoadMessages(Queue queue)
}
}
- return new {Messages = list};
+ return new { Messages = list };
})
.ContinueWith(t =>
{
@@ -128,7 +130,7 @@ void LoadMessages(Queue queue)
var result = t.Result;
queue.SetMessages(result.Messages);
-
+
return new NotificationEvent("{0} messages loaded from {1}", result.Messages.Count,
queue.QueueName);
}
View
27 src/Rebus.Snoop/MainWindow.xaml
@@ -103,6 +103,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
+ <RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<GroupBox Header="Headers" Grid.Row="0">
@@ -121,6 +122,32 @@
<TextBox Text="{Binding Machines/Queues/Messages/Body}" FontFamily="Courier New"/>
</ScrollViewer>
</GroupBox>
+
+ <GroupBox Header="Info" Grid.Row="2">
+ <GroupBox.Resources>
+ <Style x:Key="TextBoxStyle" TargetType="{x:Type TextBox}">
+ <Setter Property="Margin" Value="3"/>
+ <Setter Property="Padding" Value="3"/>
+ <Setter Property="IsReadOnly" Value="True"/>
+ </Style>
+ <Style x:Key="TextBlockStyle" TargetType="{x:Type TextBlock}">
+ <Setter Property="Margin" Value="6"/>
+ </Style>
+ </GroupBox.Resources>
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto"/>
+ </Grid.RowDefinitions>
+
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto"/>
+ <ColumnDefinition Width="*"/>
+ </Grid.ColumnDefinitions>
+
+ <TextBlock Grid.Row="0" Grid.Column="0" Text="Id" Style="{StaticResource TextBlockStyle}"/>
+ <TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Machines/Queues/Messages/Id}" Style="{StaticResource TextBoxStyle}"/>
+ </Grid>
+ </GroupBox>
</Grid>
<GridSplitter Grid.Row="1" Grid.ColumnSpan="2" Height="5" Width="Auto" ResizeDirection="Rows"
View
1 src/Rebus.Snoop/Rebus.Snoop.csproj
@@ -86,6 +86,7 @@
<Compile Include="Events\ReloadMessagesRequested.cs" />
<Compile Include="Events\ReloadQueuesRequested.cs" />
<Compile Include="Events\MessageSelectionWasMade.cs" />
+ <Compile Include="Events\MessageMoved.cs" />
<Compile Include="Msmq\MessageQueueExtensions.cs" />
<Compile Include="ViewModel\Models\Machine.cs" />
<Compile Include="ViewModel\Models\Message.cs" />
View
3 src/Rebus.Snoop/ViewModel/MachinesViewModel.cs
@@ -35,6 +35,7 @@ public MachinesViewModel()
{
new Message
{
+ Id="74839473829-43278493",
Label = "msg1",
Bytes = 1235,
Time = new DateTime(2012, 03, 19, 12, 30, 45),
@@ -59,13 +60,15 @@ public MachinesViewModel()
},
new Message
{
+ Id="74839473829-43278673",
Label = "msg2",
Bytes = 12355,
Time = new DateTime(2012, 02, 15, 12, 30, 45),
Headers = {{"rebus-content-type", "text/xml"}}
},
new Message
{
+ Id="74839473829-43274323",
Label = "msg3",
Bytes = 123553456,
Time = new DateTime(2012, 03, 19, 13, 30, 45),

0 comments on commit c79aecf

Please sign in to comment.