-
1. Re: AMQ BlobMessage is not deleted when actual messages is deleted/rollbacked
gseben Apr 27, 2009 3:46 PM (in response to armsargis_sargis)Hi there,
If I understand correctly what's going on, you would like to have the file removed from the fileserver when you remove the message from the queue where it resides.
I don't think that ActiveMQ will do that automatically for you. Removing the message from the queue or undoing the transaction will not erase the file that was uploaded. To delete the file you can use the DefaultBlobUploadStrategy or create your own BlobUploadStrategy.
As an example you can check out the DefaultBlobUploadStrategyTest junit test that comes with the source code for ActiveMQ.
Thanks,
-Gio
-
2. Re: AMQ BlobMessage is not deleted when actual messages is deleted/rollbacked
armsargis_sargis Apr 28, 2009 3:42 AM (in response to gseben)Hi thanks for response, I know about DefaultBlobUploadStrategy and viewed Test class as you suggested. but as I understand:
public void deleteFile(ActiveMQBlobMessage message) throws IOException, JMSException {
}
is not part of interface:
public interface BlobUploadStrategy {
URL uploadFile(ActiveMQBlobMessage message, File file) throws JMSException, IOException;
URL uploadStream(ActiveMQBlobMessage message, InputStream in) throws JMSException, IOException;
}
and in test you calling delete explicitly like:
DefaultBlobUploadStrategy strategy = new DefaultBlobUploadStrategy(policy);
strategy.uploadFile(msg, file);
.....
strategy.deleteFile(msg);
I think its nice to have something like template pattern, and I will override for instance uploadFile() and deleteFile(), if there is Exception FUSE automatically will call deleteFile().
But thanks again for response in fact it can be done by application developers also