Adding some further details to this topic.

I have implemented Server-Sent Events support in svnpubsub. 

The current format is preserved and the selection is made based on the client Accept header.   Sample output for both formats can be found below. Please consider the attached patch.

The next step is to verify that an existing Java library can be used to observe these events.

I have successfully implemented a client in Java using Jersey by following this example, section 15.5.2.


Anyone interested in co-developing a Jenkins Build Trigger plugin? How is ASF infra managing build triggers?

Please let me know if anyone is interested. Anyone from ASF infra on this list?

Thanks,
Thomas Å.


> GET /commits HTTP/1.1
> Host: localhost:2069
> User-Agent: curl/7.47.0
> Accept: */*
< HTTP/1.1 200 OK
< Transfer-Encoding: chunked
< Date: Mon, 05 Dec 2016 16:06:05 GMT
< X-Svnpubsub-Version: 1
< Content-Type: application/vnd.apache.vc-notify+json
< Server: TwistedWeb/16.0.0
{"svnpubsub": {"version": 1}}
{"stillalive": 1480953980.875444}
{"commit": {"committer": "testuser", "log": "test", "repository": "50217dbe-7a01-4030-aaaa-f1baa9200a11", "format": 1, "changed": {"test/test5/": {"flags": "A  "}}, "date": "2016-12-05 16:06:29 +0000 (Mon, 05 Dec 2016)", "type": "svn", "id": 97}}
{"stillalive": 1480953995.8761}



$ curl -sNv  -H "Accept: text/event-stream" http://localhost:2069/commits
> GET /commits HTTP/1.1
> Host: localhost:2069
> User-Agent: curl/7.47.0
> Accept: text/event-stream
< HTTP/1.1 200 OK
< Transfer-Encoding: chunked
< Date: Mon, 05 Dec 2016 16:07:41 GMT
< X-Svnpubsub-Version: 1
< Content-Type: text/event-stream
< Server: TwistedWeb/16.0.0
event: svnpubsub
data: {"version": 1}

event: stillalive
data: {"stillalive": 1480954076.285757}

event: commit
data: {"committer": "testuser", "log": "test", "repository": "50217dbe-7a01-4030-aaaa-f1baa9200a11", "format": 1, "changed": {"test/test6/": {"flags": "A  "}}, "date": "2016-12-05 16:08:00 +0000 (Mon, 05 Dec 2016)", "type": "svn", "id": 98}

event: stillalive
data: {"stillalive": 1480954091.286789}




On 4 dec. 2016, at 13:30, Thomas Åkesson <thomas.akes...@pdsvision.se> wrote:

Hi all,

I have been looking into svnpubsub for a couple of use cases in our XML Authoring CMS (based on Subversion). Both use cases involve Java as client to svnpubsub.

Has anyone considered developing a Jenkins Build Trigger plugin that connects to svnpubsub? Seems like the ideal way of avoiding the polling without the overhead of individual hooks.

There are a couple of similar plugins to Jenkins. One uses XMPP (looks difficult to adapt to svnpubsub) and one uses AWS SQS.

I have experimented with teaching svnpubsub the Server Side Events format with the objective to use an existing Java library (e.g. jersey) to observe those events with just a few lines of code. The intention is to make svnpubsub select format based on client accept header. 

The output would be approximately:

< HTTP/1.1 200 OK
< Transfer-Encoding: chunked
< Date: Sun, 04 Dec 2016 12:21:42 GMT
< X-Svnpubsub-Version: 1
< Content-Type: text/event-stream
< Server: TwistedWeb/16.0.0
event: svnpubsub
data: {"version": 1}

event: stillalive
data: {"stillalive": 1480854117.81563}

event: stillalive
data: {"stillalive": 1480854132.816077}

event: commit
data: {"committer": "testuser", "log": "", "repository": "50217dbe-7a01-4030-aaaa-f1baa9200a11", "format": 1, "changed": {"repos.txt": {"flags": "U  "}}, "date": "2016-12-04 12:22:22 +0000 (Sun, 04 Dec 2016)", "type": "svn", "id": 82}

event: stillalive
data: {"stillalive": 1480854147.817536}


The next step is to verify that an existing Java library can be used to observe these events.

Anyone interested in co-developing a Jenkins Build Trigger plugin? How is ASF infra managing build triggers?

Thanks,
Thomas Å.


Attachment: svnpubsub-sse_20161205.diff
Description: Binary data

Reply via email to