Fix cast issue when sending an event.
Fixes gh-458 Fixes gh-641
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.cloud.consul.binder;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.ecwid.consul.v1.ConsulClient;
|
||||
import com.ecwid.consul.v1.QueryParams;
|
||||
import com.ecwid.consul.v1.Response;
|
||||
@@ -48,12 +50,16 @@ public class ConsulSendingHandler extends AbstractMessageHandler {
|
||||
}
|
||||
|
||||
Object payload = message.getPayload();
|
||||
if (payload instanceof byte[])
|
||||
{
|
||||
payload = Arrays.toString((byte[])payload);
|
||||
}
|
||||
|
||||
// TODO: support headers
|
||||
// TODO: support consul event filters: NodeFilter, ServiceFilter, TagFilter
|
||||
Response<Event> event = this.consul.eventFire(this.eventName, (String) payload,
|
||||
new EventParams(), QueryParams.DEFAULT);
|
||||
// TODO: return event?
|
||||
// return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import com.ecwid.consul.v1.ConsulClient;
|
||||
import com.github.tomakehurst.wiremock.junit.WireMockRule;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -78,14 +77,12 @@ public class ConsulBinderApplicationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore // FIXME: 2.0.0 need stream fix
|
||||
public void shouldInitializeConsulSource() {
|
||||
|
||||
assertThat(this.events).isNotNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore // FIXME: 2.0.0 need stream fix
|
||||
public void shouldPublishTextConsulMessage() {
|
||||
|
||||
// given
|
||||
|
||||
Reference in New Issue
Block a user