Uploaded image for project: 'RichFaces'
  1. RichFaces
  2. RF-14255

Subtopic missing in processPreSubscriptionEvent

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 4.5.9
    • Fix Version/s: 4.5.16
    • Component/s: None
    • Labels:
    • Environment:

      Wildfly10

    • Steps to Reproduce:
      Hide

      Create a SessionTopicListener2:

      TopicsContext topicsContext = TopicsContext.lookup();
      Topic userSession = topicsContext.getOrCreateTopic(new TopicKey("sub@Topic"));
      userSession.addTopicListener(new BugTopicsListener());
      ...
      public class BugTopicsListener implements SessionTopicListener2{
          
              public void processPreSubscriptionEvent(SessionPreSubscriptionEvent sessionPreSubscriptionEvent) {
                 if(sessionPreSubscriptionEvent.getTopicKey().getSubtopicName() == null){
                     throw new RuntimeException("Subtopic is missing");
                 }
              }
      
              public void processSubscriptionEvent(SessionSubscriptionEvent sessionSubscriptionEvent) {
      
              }
      
              public void processUnsubscriptionEvent(SessionUnsubscriptionEvent sessionUnsubscriptionEvent){
      
              }
          }
      

      ..
      connect to the topic with a subtopic

      Show
      Create a SessionTopicListener2: TopicsContext topicsContext = TopicsContext.lookup(); Topic userSession = topicsContext.getOrCreateTopic( new TopicKey( "sub@Topic" )); userSession.addTopicListener( new BugTopicsListener()); ... public class BugTopicsListener implements SessionTopicListener2{ public void processPreSubscriptionEvent(SessionPreSubscriptionEvent sessionPreSubscriptionEvent) { if (sessionPreSubscriptionEvent.getTopicKey().getSubtopicName() == null ){ throw new RuntimeException( "Subtopic is missing" ); } } public void processSubscriptionEvent(SessionSubscriptionEvent sessionSubscriptionEvent) { } public void processUnsubscriptionEvent(SessionUnsubscriptionEvent sessionUnsubscriptionEvent){ } } .. connect to the topic with a subtopic

      Description

      subtopic in processPreSubscriptionEvent is always null.

      this seems to be caused by the following code in SessionImpl:

      private void createSubscriptions(Iterable<TopicKey> topicKeys) {
        Iterator var2 = topicKeys.iterator();
         while(var2.hasNext()) {
           TopicKey topicKey = (TopicKey)var2.next(); //hold the subtopic
           Topic pushTopic = this.topicsContext.getOrCreateTopic(topicKey); //does not hold the subtopic
           String errorMessage = null;
           if(pushTopic == null) {
             errorMessage = MessageFormat.format("Topic \'\'{0}\'\' is not configured", new Object[]{topicKey.getTopicAddress()});
           } else {
              try {
                  pushTopic.checkSubscription(this); //subtopic is lost to listeners
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                michpetrov Michal Petrov
                Reporter:
                magnus.lundgren Magnus Lundgren
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: