[Hawkular-dev] basic "deploy an app" should be working in kettle now

John Mazzitelli mazz at redhat.com
Mon Aug 10 00:09:32 EDT 2015


I got the basic use-case "deploy an application" working tonight so I released a new bus and agent with the feature so building hawkular/dist master branch should pull it in. I'll talk to the UI folks Monday morning on what they need to do next. But, in short, look at the DeployApplicationRequest JSON [1] - that's the JSON request. You must stream the application file content (the war or ear or whatever) immediately following the JSON text over the websocket as a single message.

My example .html [2] shows how I was able to stream data over the websocket to submit the request, but I did it by having the client browser load the file in memory first - not something I think we want to do in the product, but, this is how I got it to work:

=====
  <html> ... <input type="file" id="file" name="file"/> ... </html>
  ...
  <script>
  ...
  document.getElementById('file').addEventListener('change', handleFileSelect, false);
  var fileBinaryContent = null;
  function handleFileSelect(evt) {
    var theFile = evt.target.files[0];
    var reader = new FileReader();
    reader.onloadend = function(readEvent) {
      if (readEvent.target.readyState == FileReader.DONE) {
        fileBinaryContent = new Uint8Array(readEvent.target.result);
      }
    }
    reader.readAsArrayBuffer(theFile);
  }
  ...
  // when you are ready to send, do the following
  var text = "DeployApplicationRequest={...the json...}";
  var binaryblob = new Blob([text, fileBinaryContent], {type: 'application/octet-stream'});
  socket.send(binaryblob);
  ...
=====

That is all.

--John Mazz

[1] https://github.com/hawkular/hawkular-bus/blob/master/hawkular-feed-comm/feed-comm-api/src/main/resources/schema/DeployApplicationRequest.schema.json

[2] https://github.com/hawkular/hawkular-bus/blob/master/hawkular-feed-comm/feed-comm-war/websocket-test-client.html


More information about the hawkular-dev mailing list