Search in sources :

Example 16 with SignalServiceMessageReceiver

use of org.whispersystems.signalservice.api.SignalServiceMessageReceiver in project Signal-Android by signalapp.

the class RestStrategy method enqueuePushDecryptJobs.

private static int enqueuePushDecryptJobs(IncomingMessageProcessor.Processor processor, long startTime, long timeout) throws IOException {
    SignalServiceMessageReceiver receiver = ApplicationDependencies.getSignalServiceMessageReceiver();
    AtomicInteger jobCount = new AtomicInteger(0);
    receiver.setSoTimeoutMillis(timeout);
    receiver.retrieveMessages(envelope -> {
        Log.i(TAG, "Retrieved an envelope." + timeSuffix(startTime));
        String jobId = processor.processEnvelope(envelope);
        if (jobId != null) {
            jobCount.incrementAndGet();
        }
        Log.i(TAG, "Successfully processed an envelope." + timeSuffix(startTime));
    });
    return jobCount.get();
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) SignalServiceMessageReceiver(org.whispersystems.signalservice.api.SignalServiceMessageReceiver)

Aggregations

SignalServiceMessageReceiver (org.whispersystems.signalservice.api.SignalServiceMessageReceiver)16 File (java.io.File)8 InputStream (java.io.InputStream)8 IOException (java.io.IOException)6 InvalidMessageException (org.whispersystems.libsignal.InvalidMessageException)6 NonSuccessfulResponseCodeException (org.whispersystems.signalservice.api.push.exceptions.NonSuccessfulResponseCodeException)6 StickerDatabase (org.thoughtcrime.securesms.database.StickerDatabase)4 SignalServiceAttachmentPointer (org.whispersystems.signalservice.api.messages.SignalServiceAttachmentPointer)4 SignalServiceStickerManifest (org.whispersystems.signalservice.api.messages.SignalServiceStickerManifest)4 StickerInfo (org.whispersystems.signalservice.api.messages.SignalServiceStickerManifest.StickerInfo)4 MissingConfigurationException (org.whispersystems.signalservice.api.push.exceptions.MissingConfigurationException)4 Bitmap (android.graphics.Bitmap)2 Nullable (androidx.annotation.Nullable)2 FileInputStream (java.io.FileInputStream)2 FileNotFoundException (java.io.FileNotFoundException)2 ArrayList (java.util.ArrayList)2 ExecutionException (java.util.concurrent.ExecutionException)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 GroupSecretParams (org.signal.zkgroup.groups.GroupSecretParams)2 ProfileKey (org.signal.zkgroup.profiles.ProfileKey)2