I have requirements that all of our endpoints be unobtrusive. This has worked fine until I started working on a new DataBus strategy for a new feature. The DataBus solution is very nice and saves a lot of code, however using unobtrusive mode with it does not allow me to properly clean up the databus attachment in the fileshare. Usually, with DataBus, we use the DataBusProperty<byte> type which stores the filepath and provides access to the byte content with the Value property. This property also has a Key property which I can use to find the file in the fileshare. I can use this Key property to then clean up the attachment and remove it from the fileshare after I have successfully handled the message.
The problem is that when I use an unobtrusive mode for the databus transfer I am forced to use a byte with a conventional name. The content is automatically supplied in the hadler but I lose access to the Key property which I need to then clean up the attachment from the fileshare after successfully handling the message. This forces me to do a manual cleanup strategy for the fileshare which really sucks. In the end, it is forcing me to not use the databus strategy but to just use the old fashioned fileshare practices for the message transfer.
My question is, is there a better cleanup strategy when using the FileShareDataBus with unobtrusive mode? A suggestion would be to use a tuple<string, byte> that provides access to the key for the file in the fileshare instead of just using byte for the databus transfer.