Quantcast

Message order during export/import

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Message order during export/import

TheQL
Hello,

is it possible to somehow make sure that message order is retained when exporting and importing queues? It seems as though this is somewhat shuffled around, at least the import does not match the filename order from the directory specified for import.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Message order during export/import

IIT Software
Administrator
Messages are ordered in a queue by 1) priority and 2) message index (seq no). This is the order how they are exported. It is the same order as if you were consuming them from a queue.

On import the priority is the first order. The message index (seq no) is new assigned. So if you import messages in a queue with different priorities, they are may have a different order. If all messages in the queue have the same priority as the messages you want to import, they will be appended to the queue.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Message order during export/import

TheQL
The initial queue is fed by a mailbridge (in fact 2 mostly identical bridges apart from the polled IMAP server), so all prios should be identical.

The export created files with sequence numbering, e.g.

App_Inbox_0000000001.message
...
App_Inbox_0000001061.message
App_Inbox_0000001062.message
...

Now I put some of these files in a directory and import them (all would be too many and take a lot of time).

The first file being:
App_Inbox_0000000241.message, which has the following ID
ID:-1918204342546787530/9574898/routerXY/javamailbridge/App_Inbox_Mailbridge/1458234004643/9246

The last one being:
App_Inbox_0000000280.message, which has the following ID
ID:-1918204342546787530/9574901/routerXY/javamailbridge/App_Inbox_Mailbridge_2/1458234006045/9620

The last message in the queue at the moment before importing has the following ID:
ID:-1918204342546787530/9574898/routerXY/javamailbridge/App_Inbox_Mailbridge/1458234004643/9237

So I import 40 messages and look for my above message. After I've found it, the next message should have the ID from the file imported first. ID:-1918204342546787530/9574898/routerXY/javamailbridge/App_Inbox_Mailbridge/1458234004643/9246

But the next message has the ID:-1918204342546787530/9574901/routerXY/javamailbridge/App_Inbox_Mailbridge_2/1458234006045/9616
which matches the file App_Inbox_0000000273.message

The last message has the ID:-1918204342546787530/9574898/routerXY/javamailbridge/App_Inbox/1458234004643/9262
which matches the file App_Inbox_0000000275.message

I found the ID from App_Inbox_0000000280.message at the 5th index from the back of the queue. I can not make any order from this.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Message order during export/import

IIT Software
Administrator
Oops, I see. Checked the code and it seems we are using File.listFiles(..) without sorting the result. listFiles itself doesn't guarantee any ordering so this needs to be fixed.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Message order during export/import

TheQL
Ok, thanks, I'm glad I'm not that confused in the end ;)
Loading...