Propagating message received update to sender

This commit is contained in:
Kai S. K. Engelbart 2020-02-05 16:15:01 +01:00
parent 98e5245780
commit d5b7bcc301
2 changed files with 3 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import java.io.IOException;
import java.util.Date;
import envoy.data.Message;
import envoy.event.MessageStatusChangeEvent;
import envoy.server.ConnectionManager;
import envoy.server.ObjectProcessor;
import envoy.server.database.PersistenceManager;
@ -36,6 +37,7 @@ public class MessageProcessor implements ObjectProcessor<Message> {
// Update the message status to RECEIVED
message.setReceivedDate(new Date());
message.nextStatus();
writeProxy.write(connectionManager.getSocketId(message.getSenderId()), new MessageStatusChangeEvent(message));
} catch (IOException e) {
System.err.println("Recipient online. Failed to send message" + message.getId());
e.printStackTrace();

View File

@ -29,8 +29,7 @@ public class MessageStatusChangeProcessor implements ObjectProcessor<MessageStat
// any other status than read is not supposed to be sent to the server
if (input.get() != MessageStatus.READ) throw new EnvoyException("Message" + input.getId() + "has an invalid status");
} catch (EnvoyException e) {
e.printStackTrace();
return;
throw new IOException(e);
}
ConnectionManager conMan = ConnectionManager.getInstance();
PersistenceManager perMan = PersistenceManager.getPersistenceManager();