Ejemplo n.º 1
0
  @Test(expected = RuntimeException.class)
  public void exceptionDuringPublishingIsNotIgnored() throws Exception {
    RMQSink<String> rmqSink = createRMQSink();

    doThrow(IOException.class).when(channel).basicPublish("", QUEUE_NAME, null, MESSAGE);
    rmqSink.invoke("msg");
  }
Ejemplo n.º 2
0
  @Test
  public void exceptionDuringPublishingIsIgnoredIfLogFailuresOnly() throws Exception {
    RMQSink<String> rmqSink = createRMQSink();
    rmqSink.setLogFailuresOnly(true);

    doThrow(IOException.class).when(channel).basicPublish("", QUEUE_NAME, null, MESSAGE);
    rmqSink.invoke("msg");
  }
Ejemplo n.º 3
0
  @Test
  public void invokePublishBytesToQueue() throws Exception {
    RMQSink<String> rmqSink = createRMQSink();

    rmqSink.invoke(MESSAGE_STR);
    verify(serializationSchema).serialize(MESSAGE_STR);
    verify(channel).basicPublish("", QUEUE_NAME, null, MESSAGE);
  }
Ejemplo n.º 4
0
  @Test
  public void closeAllResources() throws Exception {
    RMQSink<String> rmqSink = createRMQSink();

    rmqSink.close();

    verify(channel).close();
    verify(connection).close();
  }
Ejemplo n.º 5
0
 private RMQSink<String> createRMQSink() throws Exception {
   RMQSink rmqSink = new RMQSink<String>(rmqConnectionConfig, QUEUE_NAME, serializationSchema);
   rmqSink.open(new Configuration());
   return rmqSink;
 }