Propagating message received update to sender
This commit is contained in:
parent
ad8c9b654f
commit
74786f469b
@ -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();
|
||||
|
@ -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();
|
||||
|
Reference in New Issue
Block a user