Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ...
- QueueServerConnection queueServerConnection = new QueueServerConnection();
- queueServerConnection.createConnection();
- queueServerConnection.sendMessage("Expired for user = " + userDAO.getUserId())
- queueServerConnection.closeConenction();
- ...
- ...
- ConnectionFactory factory = new ConnectionFactory();
- factory.setHost("localhost");
- Connection connection = factory.newConnection();
- Channel channel = connection.createChannel();
- channel.queueDeclare(QUEUE_NAME, false, false, false, null);
- System.out.println(" [*] Waiting for messages...");
- Consumer consumer = new DefaultConsumer(channel) {
- @Override
- public void handleDelivery(... byte[] body) throwsIOException {
- String message = new String(body, "UTF-8");
- if( message.equals("EXpired") ){
- MailService mailService = new MailService("senderEmail","password");
- mailService.sendMail("to", "Your time expired !)";
- }
- }
- };
- ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement