Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: How to get channel name used in gateway?

  1. #1
    Join Date
    May 2010
    Posts
    15

    Unhappy 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. #2
    Join Date
    Jan 2009
    Location
    Ukraine, Kharkov
    Posts
    632

    Default

    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 Cleric; Jun 2nd, 2011 at 01:43 AM.

  3. #3
    Join Date
    May 2010
    Posts
    15

    Default

    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?

  4. #4
    Join Date
    Jan 2009
    Location
    Ukraine, Kharkov
    Posts
    632

    Default

    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();

  5. #5
    Join Date
    May 2010
    Posts
    15

    Default

    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

  6. #6
    Join Date
    Jan 2009
    Location
    Ukraine, Kharkov
    Posts
    632

    Default

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

  7. #7
    Join Date
    May 2010
    Posts
    15

    Default

    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.

  8. #8
    Join Date
    May 2010
    Posts
    15

    Default

    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+"'},");
    }

  9. #9
    Join Date
    Jan 2009
    Location
    Ukraine, Kharkov
    Posts
    632

    Default

    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.

  10. #10
    Join Date
    Jan 2008
    Location
    Mohnton, PA USA (that's near Philadelphia)
    Posts
    2,148

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •