Announcement Announcement Module
Collapse
No announcement yet.
How to get channel name used in gateway? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to get channel name used in gateway?

    Code:
    <jms:inbound-gateway id="mindMessageHODXGateway"
    		request-destination="mindQueueHODX" request-channel="mindMessageChannel"
    		error-channel="mindMessageConsumptionErrorChannel" auto-startup="false"
    		extract-request-payload="false" selector="SERVICE='HODX'"
    		request-timeout="-1" />
    it's my gateway configuration.
    Now i can get the gateway instance from the application context.
    It's an instance of 'JmsMessageDrivenEndpoint'.
    But i can't get the channel name used in the instance.
    The name is for me to look up the channel instance in the application context.
    Can somebody help me ?

  • #2
    Hello.
    What do you mean about "channel name"?
    Your inbound-gateway must read JMS-message from mindQueueHODX and place SI-message into channel mindMessageChannel
    What is the reason about auto-startup="false"?

    Artem
    Last edited by Artem Bilan; Jun 2nd, 2011, 02:43 AM.

    Comment


    • #3
      thanks my friend.
      All that i have to do is to write java code to get the gateway.
      I get the gateway instance by looking up the application context.
      But i can't get the channel name or channel instance the gateway used.
      The reason I have to get the channel is to monitor the message amount in the channel.
      What can i do?

      Comment


      • #4
        I think it can be like this:
        HTML Code:
         <channel id="mindMessageChannel">
                <queue/>
          </channel>
        And the Java code for reading that channel:
        Code:
        QueueChannel channel = context.getBean("mindMessageChannel", ueueChannel.class);
        channel.getQueueSize();

        Comment


        • #5
          hi friend:
          My code is below:
          JmsMessageDrivenEndpoint gateway= context.getBean("mindMessageHODXGateway", JmsMessageDrivenEndpoint.class);

          Because
          I don't know the channel's name .
          I just know the gateway's name .
          I have many gateways , And I just want to get the channel instance through gateway instance

          Comment


          • #6
            What is your SI-config?
            How do you develope application, if you don't know your Spring config?
            I'm confused...

            Comment


            • #7
              I got the gateway in JAVA Code but read the config file manually.
              I got all the gateway filter by type in java code.
              After a get the gateway intance , it's no way for me to get the channel instance the gateway used in my java code.

              Comment


              • #8
                Map<String, JmsMessageDrivenEndpoint> beanGatewayList = appContext.getBeansOfType(JmsMessageDrivenEndpoint .class);
                Iterator<JmsMessageDrivenEndpoint> gatewayIterator =(Iterator<JmsMessageDrivenEndpoint>)beanGatewayLi st.values().iterator();
                while(gatewayIterator.hasNext()){
                JmsMessageDrivenEndpoint bean = gatewayIterator.next();
                new StringBuffer().append("{name:'" +bean.getComponentName()+"',"+
                "status:'" +(bean.isRunning()?"running":"inactive")+"',"+
                "server:'" +(request.getServerName()+":"+request.getServerPor t())+contextString+"'},");
                }

                Comment


                • #9
                  I think you must view object graph in debug with bearkpoint on JmsMessageDrivenEndpoint.onInit().
                  And see the value of property listener.requestChannel of JmsMessageDrivenEndpoint.
                  But I still can't understand why can't you read config XML with your own eyes.

                  Comment


                  • #10
                    Can you please explain the reason why you need to extract channel name from the Gateway.
                    Inbound gateways are the entry points to SI which essentially bridge the remote system and SI configuration by getting data from the remote system, converting it to a Message and sending it to a channel which is only known to the gateway. The bottom line is that you personally do not interact with inbound gateways.
                    Outbound gateway is the same but in the oposite direction. You stil don't interact with it directly. You simply send a Message to a channel who's subscriber is outbound gateway.

                    Comment


                    • #11
                      To Oleg.zhurakousky
                      The reason why I have to access the channel is that my application wants to monitor a gateway and the channel it used.
                      I want to know the message remaining amounts of the channels before I start or stop the gateway.

                      To Cleric:
                      Sorry for bringing you many misunderstanding.
                      Not I but my application doesn't know the channel's name used in gateway.
                      My application just get gateway from spring application context by bean type.
                      But it doesn't know which channel is used by the gateway.

                      Comment


                      • #12
                        Well, we have a special module dedicated for management and monitoring of SI components.
                        Please read http://static.springsource.org/sprin...gement-chapter

                        Comment


                        • #13
                          Appreciations for your help~
                          Let me take a close look at it.

                          Comment


                          • #14
                            Originally posted by oleg.zhurakousky View Post
                            Well, we have a special module dedicated for management and monitoring of SI components.
                            Please read http://static.springsource.org/sprin...gement-chapter
                            hi friend .
                            Another questions .
                            I have to set the monitoring data to a java bean.
                            In order to list the data in a dashboard.
                            how can i do ?

                            Comment


                            • #15
                              Originally posted by oleg.zhurakousky View Post
                              Well, we have a special module dedicated for management and monitoring of SI components.
                              Please read http://static.springsource.org/sprin...gement-chapter
                              hi friend .
                              Another questions .
                              I have to set the monitoring data to a java bean.
                              In order to list the data in a dashboard.
                              how can i do ?

                              Comment

                              Working...
                              X