Code example for Queue

Methods: add, remove, size

0
 
	/** 
	 * This method is invoked when a RabbitMQ Message is received. 
	 */ 
	public void handleChatMessage(String message) {
		if (chatMessages.size() > 100) {
			chatMessages.remove();
			// mostra solo gli ultimi 100 
		} 
		//List<ChatMessage> m = mongoTemplate.find(query(where("routingKey").is("chatQueue")), ChatMessage.class);         
		chatMessages.add(message);
	} 
 
}