Setting Stream Metdata

I think there’s a bit of a Catch 22 going on since the explicit stream creation operation has gone.

What I want to do is, on startup, make sure that the stream metadata maxAge is set to a particular value. I can GET:

http://localhost:1114/streams/testStream/metadata

And it returns metadata for me, but the docs state:

However, you should not access metadata by constructing this URL yourself, as the right to change the resource address is reserved. Instead, you should follow the link for from the stream itself, which will enable your client to tolerate future changes to the addressing structure without breaking.

Which makes sense (and is nice to see), but if I try and GET:

http://localhost:1114/streams/testStream

I just get a 404 because the stream does’t exist yet, so I’m kinda stuck - I don’t want to send a “dummy event” to the stream just to force it to be created (and could I even guarantee that the stream woudl be immediately available for GETing?) so how do I do this without having to try and update the metadata on every send and see if it’s sucessful? I think perhaps getting the stream resource shouldn’t be returning a 404, and POSTing to the metadata resource should create the stream if it doesn’t already exist?

I guess in that case it could return an empty feed but only if metadata exists. I will take a look at it.

Still catch 22 though - I need to be able to GET the stream resource in order to traverse the link to the metadata resource, or is there a way to POST an emtpy payload to a stream to get it to create without pushing an event in?

Yes in that case it is for the first attempt you have to bookmark).

But if you reserve the right to change the metadata url in a future version, my client is going to potentially break, even on the first attempt?

I know what you are getting at … no we will not be changing it. That is mainly there in the docs to let people know they should get the link from the atom feed (you would be amazed how many hard code all their uris). In the one edge case I dont think there is a way around bookmarking it (unless we remove ability to do it as a whole which is a bad thing as there are times you want to do it).

Ok, cool, thanks - I’ll add “// if this breaks blame Greg ;-)” into my startup code :stuck_out_tongue:

lol no worries.

I think we should explicitly allow bookmarking of metadata URLs for this purpose - anyone have any objections?

James