package org.camunda.bpm.extension.cloud.broadcaster;

import com.netflix.hystrix.HystrixCommand;
import com.netflix.hystrix.HystrixCommandGroupKey;
import org.springframework.http.HttpEntity;
import org.springframework.web.client.RestTemplate;

public class BroadcastEventCommand extends HystrixCommand<String> {

  private final String url;
  private final HttpEntity<String> request;

  private final RestTemplate rest = new RestTemplate();

  public BroadcastEventCommand(String url, HttpEntity<String> request) {
    super(HystrixCommandGroupKey.Factory.asKey("BroadcastEvent"));
    this.url = url;
    this.request = request;
  }

  @Override
  protected String run() throws Exception {
    return rest.postForObject(url, request, String.class);
  }
}

@@ -141,16 +141,73 @@
 oupKey;%0A
+import org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A
 import o
@@ -364,16 +364,109 @@
 ing%3E %7B%0A%0A
+  public static final Logger LOGGER = LoggerFactory.getLogger(BroadcastEventCommand.class);%0A%0A
   privat
@@ -898,11 +898,147 @@
 ss);%0A  %7D
+%0A%0A  @Override%0A  protected String getFallback() %7B%0A    LOGGER.error(%22Broadcast of event failed.%22);%0A    return %22%7B'status' : 'failed'%7D%22;%0A  %7D
 %0A%7D%0A

add fallback