Dispose messages with persistence service

7 posts / 0 new
Last post
Offline
Last seen: 2 years 10 months ago
Joined: 04/28/2013
Posts: 38
Dispose messages with persistence service

Hello, 
I'm currently using the persistence service to relay data to late joiners. I've run a simple scenario of sending 60 messages, then closing the DataWriter and opening a DataReader. I do receive the 60 messages on the DataReader, but I also receive an additional message. From previous inquiries I was told it's a dispose message (is it supposed to be sent when I close the DataWriter?). To prevent it from being sent (I want to receive only the messages the DataWriter sent), I set the propagate_dispose to false. That solved the problem, but now I want to persist a map and so any time I remove something from the map, the persistence service doesn't propagate the dispose message. Is there a way to differentiate between the two behaviors and propagate the dispose messages only for applicative removal? 

Thanks, Michael

rose's picture
Offline
Last seen: 1 month 1 day ago
Joined: 08/22/2011
Posts: 148

Hello Michael,

There are two parts to this - how the original application behaves, and how the Persistence Service should behave:

1. You don't want the DataWriter to automatically send a dispose message when it is shut down.  This is controlled by the writer_data_lifecycle QoS.  To prevent the DataWriter from sending a dispose message for all of its instances when it is shut down, you must set writer_data_lifecycle.autodispose_unregistered_instances to false.  By default it is set to true, which means that when a DataWriter is shut down, it automatically both unregisters and disposes its instances.  Note that an unregister message will still be sent when this DataWriter is shut down.

2. You do want the Persistence Service to propagate dispose messages, so you should revert the propagate_dispose setting to true.  However, you do not necessarily want it to propagate the unregister message, so you can set <propagate_unregister> to false.

Let me know if you have any questions!

Thank you,

Rose

Offline
Last seen: 2 years 10 months ago
Joined: 04/28/2013
Posts: 38

Thanks Rose,

In another case, suppose I want to send some data and later dispose of it. In such a case the persistence service will forward all the initial data and the dispose message. Is there a way to configure the persistence service to delete the data locally (before sending it to the late-joining DataReader). Ideally I'd want to send to the late-joining DataReader only the most relevant data, so if at any point I receive a dispose message before the initial data was forwarded, I'd prefer to take care of it as soon as possible. Is there a way to get such functionality?

Thanks a lot,

Michael

rose's picture
Offline
Last seen: 1 month 1 day ago
Joined: 08/22/2011
Posts: 148

Hello Michael, 

We have an outstanding feature request for that functionality, but we don't actually support that at the moment. 

Thank you!

Rose

Offline
Last seen: 2 years 10 months ago
Joined: 04/28/2013
Posts: 38

I was advised to use autopurge_disposed option in the PRSTDataReader reader_data_lifecycle? I tried setting it to 1 nanosecond, so essentially PRSTDataReader constantly checks if there are disposed samples present and removes them. I tried experimenting with it and it seems to work (except the fact that the dispose message is still propagated, even though all the samples were removed). That fact that it worked seemed a bit weird to me, as the samples were already stored to disk before the dispose was sent, so I don't really understand how the purging in the PRSTDataReader affects it at all. Maybe I'm missing something...

Thanks for the feedback,

Michael

rose's picture
Offline
Last seen: 1 month 1 day ago
Joined: 08/22/2011
Posts: 148

Hello Michael,

I am working with JuanJo, but right now I cannot reproduce the behavior you see.

Thank you!
Rose

xty250hp's picture
Offline
Last seen: 4 years 8 months ago
Joined: 03/09/2015
Posts: 21

Hi ,

I am facing with somehow the exact isue. In my case I have a persistent topic which has a dynamic depth and a transient local durability. The idea is that I need a mechanism more like a reset which will reset the depth and republish all neded messages based on that length.

On this topic I have at any given time the state of my system which is loaded by all later joining subscribers.

My issue is that even if I set first the depth to 10 and then reset to 1 I will receive all 10 messages.

If you can point me to a fix for that I would gladly appreciate the help.

Thank you.