This discussion is archived
7 Replies Latest reply: Mar 12, 2013 5:57 AM by Brian Oliver RSS

Messaging pattern problem in version 2.8.6

Mauricio Arango Newbie
Currently Being Moderated
Hi,

I got the following error when running a basic application to test the Coherence messaging pattern:

2012-11-27 14:36:53.262/8.836 Oracle Coherence GE 3.7.1.0 <Warning> (thread=Environment.Background.Executor:Thread-2, member=1): An exception occurred when the Queue tried to invoke Message.makeVisibleTo for message MsgId{6-1} and subscription SubscriptionIdentifier{destinationIdentifier=Identifier{test-queue}, subscriberIdentifier=Identifier{0x0000013B435F352D0A00011CFA0E283D61F076068C0F65ABC2A71BC16FEF6C92}}. The message will be delivered to another subscription

This error occurs on the thread that reads from a queue and messages are never read. The Coherence messaging pattern version used is 2.8.6.
The program runs fine with no errors when using version 2.8.4.

The application,based on previous forum postings, has a publisher thread that sets up the queue, starts a subscriber thread and then loops publishing messages;
the subscriber thread loops reading and printing received messages. Here's the code used:


package coherence.messaging;

import java.util.concurrent.Executors;

import com.oracle.coherence.common.identifiers.Identifier;
import com.oracle.coherence.patterns.messaging.DefaultMessagingSession;
import com.oracle.coherence.patterns.messaging.MessagingSession;
import com.oracle.coherence.patterns.messaging.Subscriber;

public class MessagingServer {
     
     private static final String QUEUE= "test-queue";

public static void main(String[] args) throws InterruptedException {
     System.out.println("Started publisher thread");
     MessagingSession messagingSession = DefaultMessagingSession.getInstance();
     Identifier queueIdentifier = messagingSession.createQueue(QUEUE);
     Executors.newSingleThreadExecutor().submit(new Listener());
     for (int i = 0;; i++) {
          Thread.sleep(2000);
          String msg = "messsage-" + i;
          messagingSession.publishMessage(queueIdentifier, msg);
          System.out.println("Sent: " + msg);
}
}


private static class Listener implements Runnable {

     public void run() {
          System.out.println("Started subscriber thread");
          MessagingSession messagingSession = DefaultMessagingSession.getInstance();
          Subscriber subscriber = messagingSession.subscribe(QUEUE);      
          while (true) {
               try {
                    String msg = (String)subscriber.getMessage();
                    System.out.println("Received: " + msg);
               }
               catch (Exception e){
                    System.err.println(e.getMessage());
               }
          }
}
}
}

It seems there is an error in version 2.8.4.
Thanks,

Mauricio

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points