Hello,
This release:
Add support to split MBOX and the new events:
To conform with the PersonalStorage.SplitInto events, I assume that MboxStorageReader.EmlCopied is equivalent to PersonalStorage.ItemMoved.
But the crucial missing one is the equivalent event of PersonalStorage.StorageProcessed in MboxStorageReader, I mean when using MboxStorageReader.SplitInto will need a StorageProcessed event to raise when each new storage chunk is done and the inner writer stream is closed!
Hello,
May I request minor improvements?
PersonalStorage.SplitInto(Size, String.Empty, Path) will make chunk parts: part0.pst , part1.pst , part2.pst , part3.pst …
But
MboxStorageReader.SplitInto(Size, Path, String.Empty) will make chunk parts: mbox_part0.dat , mbox_part1.dat , mbox_part2.dat , mbox_part3.dat …
1st no idea why chunk parts have .dat extension? We’re splitting Mbox and result files should have .mbox / .mbx extension based on the source storage, .dat is Tnef, not related at all.
2nd, if you compare the above 2 usages, first one makes part0.pst… and second one makes mbox_part0.dat…
Possible to remove the initial mbox_ prefix?
To conform with the PersonalStorage.SplitInto naming scheme.
3rd, which MboxStorageReader event offers cancellation of operation in the middle of long split tasks? Such event still does not exist for PersonalStorage hence no way to terminate the operation so curious if this was added for MboxStorageReader?
Thanks for your kind attention.
@australian.dev.nerds,
Thank you for the valuable comments.
We have opened the following new ticket in our internal issue tracking system:
Issue ID(s): EMAILNET-41297
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
1 Like
Hello and thanks for implementing EMAILNET-41297 Improve the MboxStorageReader.SplitInto method in 24.4
Just to confirm, my post included 3 notes, which one(s) is the new fix for?
Thanks again for the valuable work
Hello,
All 3 notes have been provided as far as I know.
1 Like
Thanks, I confirm issue 1 and 2.
For 3rd one:
I guess
MboxStorage_EmlCopied = PSTStorage_ItemMoved
and
MboxStorage_MboxFileFilled = PSTStorage_StorageProcessed
But where’s the 3rd note about the event which offers cancellation of operation in the middle of long split tasks?
Best
Sorry just checking if there’s hope to have the PstStorage/MboxStorage cancel events during SplitInto methods anytime soon?
Hi @australian.dev.nerds
To cancel an operation in the middle of a long split task, you can use the SplitInto method with the CancellationToken parameter. See the code below for an example.
int messageCount = 0;
int partCount = 0;
FileStream fs = File.OpenRead("Inbox.mbox");
string outputPath = "d:\\test_mbox\\";
var tokenSource = new CancellationTokenSource();
var mbox = new MboxrdStorageReader(fs, new MboxLoadOptions { LeaveOpen = false });
// Subscribe to events
mbox.MboxFileCreated += (sender, e) =>
{
partCount++;
if (partCount >= 5)
tokenSource.Cancel();
};
mbox.EmlCopied += (sender, e) =>
{
messageCount++;
if (messageCount >= 40)
tokenSource.Cancel();
};
System.Threading.Tasks.Task task = mbox.SplitInto(10000000, outputPath, tokenSource.Token);
task.Wait();
fs.Close();
tokenSource.Dispose();
Note: for a trial license, the max number of messages processed is 50.
1 Like
Thanks, I use Thread:
Dim blah As New Thread(AddressOf blahThread)
blah.Start
Cancelling this type of thread will result in unexpected results.
My bad, I asked about a cancelling thread, it should be a .Cancel property in:
PersonalStorage.Cancel
MboxStorageReader.Cancel
So we define a private PersonalStorage/MboxStorageReader with events and can call .Cancel anywhere in the form events (to be specific. under cancel button click)
How’s that?
I see, we will review your case and reply.
We have implemented the scheme that Microsoft proposes for asynchronous processing with long I/O operations. You don’t need to use Thread. What you require will still be executed in a separate thread, because it is not possible to interrupt the load without asynchronous execution. Please refer to this MS Doc.
Thanks for the info, appreciated, but that’s for .NET 4.5 and above.
And it does not suggest to force only Async.
May I ask to add this extra notes, please?
Many email SDKs I’ve seen had .Abort/.Cancel like this:
or had 2 separate versions:
and
Adding .Abort / .Cancel will only need a check in the beginning of each item’s processing in the inner loop code.
Thanks, you are correct, in that case we will consider adding such functionality.
We have opened the following new ticket in our internal issue tracking system.
Issue ID(s): EMAILNET-41340
1 Like
Hello
Are those features added yet?
Hello,
Yes, those features have been added.