|
|
|
@ -15,6 +15,7 @@ |
|
|
|
*/ |
|
|
|
package org.thingsboard.server.common.msg.queue; |
|
|
|
|
|
|
|
import com.google.common.util.concurrent.SettableFuture; |
|
|
|
import org.thingsboard.server.common.data.id.EntityId; |
|
|
|
|
|
|
|
import java.util.UUID; |
|
|
|
@ -34,7 +35,7 @@ public interface TbCallback { |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
default UUID getId(){ |
|
|
|
default UUID getId() { |
|
|
|
return EntityId.NULL_UUID; |
|
|
|
} |
|
|
|
|
|
|
|
@ -42,4 +43,18 @@ public interface TbCallback { |
|
|
|
|
|
|
|
void onFailure(Throwable t); |
|
|
|
|
|
|
|
static <V> TbCallback wrap(SettableFuture<V> future) { |
|
|
|
return new TbCallback() { |
|
|
|
@Override |
|
|
|
public void onSuccess() { |
|
|
|
future.set(null); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onFailure(Throwable t) { |
|
|
|
future.setException(t); |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|