Skip to content

Commit 5b32463

Browse files
committed
Do not auto create destination folder to align with other transports not being able to send a message when a queue does not exist
1 parent 075d256 commit 5b32463

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/NServiceBus.Core/Transports/Learning/LearningTransportDispatcher.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ async Task WriteMessage(string destination, IOutgoingTransportOperation transpor
6666
var destinationPath = Path.Combine(basePath, destination);
6767
var bodyDir = Path.Combine(destinationPath, LearningTransportMessagePump.BodyDirName);
6868

69-
Directory.CreateDirectory(bodyDir);
69+
if (!Directory.Exists(bodyDir))
70+
{
71+
throw new DirectoryNotFoundException("Destination folder does not exist. Ensure receiving endpoint has created the folder and check casing if storage is case-sensitive.");
72+
}
7073

7174
var bodyPath = Path.Combine(bodyDir, nativeMessageId) + LearningTransportMessagePump.BodyFileSuffix;
7275

0 commit comments

Comments
 (0)