Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
mookid8000 committed Nov 15, 2023
1 parent 99d9704 commit 3148188
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 83 deletions.
2 changes: 1 addition & 1 deletion Rebus.Tests.Contracts/Rebus.Tests.Contracts.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="[12.0.1,14)" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit" Version="3.14.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="Errors\" />
Expand Down
6 changes: 3 additions & 3 deletions Rebus.Tests/Rebus.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
<ProjectReference Include="..\Rebus.Tests.Contracts\Rebus.Tests.Contracts.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.3.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="DataBus\Encryption\" />
Expand Down
82 changes: 3 additions & 79 deletions Rebus/Transport/FileSystem/FileSystemTransport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ public Envelope(Dictionary<string, string> headers, byte[] body)
}
}

/// <summary>
/// Sends the outgoing messages by writing them as files in the file system
/// </summary>
protected override async Task SendOutgoingMessages(IEnumerable<OutgoingTransportMessage> outgoingMessages, ITransactionContext context)
{
var index = 0;
Expand Down Expand Up @@ -272,85 +275,6 @@ protected override async Task SendOutgoingMessages(IEnumerable<OutgoingTransport

}

// class OutgoingMessage
// {
// public static async Task<OutgoingMessage> WriteTemp(string destinationDirectoryPath, TransportMessage message)
// {
// var filePath = Path.Combine(destinationDirectoryPath, $"{Guid.NewGuid():N}.tmp");
// try
// {
// var outgoingMessage = new OutgoingMessage(destinationDirectoryPath, filePath);
// var contents = Serializer.Serialize(new Envelope(message.Headers, message.Body));

// using (var destination = File.OpenWrite(filePath))
// using (var writer = new StreamWriter(destination, Encoding.UTF8))
// {
// writer.Write(contents);
// }

// return outgoingMessage;
// }
// catch (Exception exception)
// {
// throw new IOException($@"Could not write outgoing message to

// {filePath}
//", exception);
// }
// }

// readonly string _destinationDirectoryPath;
// readonly string _tempFilePath;

// OutgoingMessage(string destinationDirectoryPath, string tempFilePath)
// {
// _destinationDirectoryPath = destinationDirectoryPath;
// _tempFilePath = tempFilePath;
// }

// public void Complete(Guid unitOfWorkId, DateTimeOffset now, int index)
// {
// var finalFilePath = Path.Combine(_destinationDirectoryPath, $"{now:yyyyMMdd}-{now:HHmmss}-{unitOfWorkId:N}-{index:000000}.rebusmessage.json");
// var attempts = 0;

// while (true)
// {
// attempts++;
// try
// {
// File.Move(_tempFilePath, finalFilePath);
// return;
// }
// catch (Exception) when (attempts < 5)
// {
// Thread.Sleep(500);
// }
// catch (Exception exception)
// {
// throw new IOException($@"Could not commit message by renaming temp file

// {_tempFilePath}

//into final file

// {finalFilePath}

//even after {attempts} attempts
//", exception);
// }
// }
// }

// public void Delete()
// {
// try
// {
// File.Delete(_tempFilePath);
// }
// catch { }
// }
// }

/// <summary>
/// Disposes the transport by releasing all currently locked messages
/// </summary>
Expand Down

0 comments on commit 3148188

Please sign in to comment.