Reputation: 417
I have messages in Map - key as a Queue Name and value as a List of messages. Whenever I publish the multiple message to queue server throws an exception as user has reached the maximum number of sign-ins permitted.
while publishing messages to 1 queue. Below is code which executes:
public class MessageManager {
public static void publish(String exchange, HashMap<String, List<String>> queueNameWithMessages) throws IOException {
...
ConnectionFactory factory = new ConnectionFactory();
factory.setHost(Constants.HOST_NAME);
factory.setUsername(Constants.USER_NAME);
factory.setPassword(Constants.PASSWORD);
factory.setPort(Constants.PORT);
Connection connection = factory.newConnection();
Channel ch = connection.createChannel();
Channel ch1 = connection.createChannel();
try {
for(Entry<String, List<String>> entry : queueNameWithMessages) {
String routingKey = entry.getKey();
for(String messageToBeSent : entry.value()) {
ch.basicPublish(exchange, routingKey, true, MessageProperties.PERSISTENT_BASIC, messageToBeSent.getValue().getBytes());
}
ExecutorService threadExecutor = Executors.newFixedThreadPool(5);
String responseKey = props.getProperty(routingKey);
if(!CLAMUtility.workingListnerToRespnseQueue.contains(responseKey)) {
Worker fast = new Worker(0, threadExecutor, ch1,responseKey, routingKey);
CLAMUtility.workingListnerToRespnseQueue.add(responseKey);
}
}
ch.close();
System.out.println("Message published successfully!\n \n");
} catch (Exception e) {
e.printStackTrace();
}
}
}
Upvotes: 0
Views: 431
Reputation: 417
We discover that this issue is not related to Rabbit MQ. Message consumer system has some user interaction related limitations that is not handled properly.
Thanks!
Upvotes: 0