19 package org.turro.push.sender;
21 import java.util.function.Consumer;
22 import java.util.logging.Level;
23 import java.util.logging.Logger;
24 import org.turro.assistant.Assistant;
25 import org.turro.assistant.AssistantSet;
26 import org.turro.elephant.context.ElephantContext;
27 import org.turro.push.UserPushSubscription;
36 private final String payload;
37 private Consumer onFinish;
40 this.assistants = assistants;
41 this.payload = payload;
44 public void send(Consumer onFinish) {
45 this.onFinish = onFinish;
46 if(assistants.size() > 20) {
47 new Thread(
this).start();
58 Logger.getLogger(
PushPoolSender.class.getName()).log(Level.INFO,
"Pushed message to {0}. Payload: {1}",
59 new Object[]{assistant.name, payload});
62 if(onFinish !=
null) {
64 onFinish.accept(
null);
65 }
catch (Exception ex) {
static String logMsg(String msg)
static void pushMessage(String idContact, String payload)
void send(Consumer onFinish)
PushPoolSender(AssistantSet assistants, String payload)