agentAsyncContext use within threaded exchange 2010 routing agent RRS feed

  • Question

  • Perhaps someone can answer the following questions:

    1) Can anyone confirm the if the creation of threads within exch2k10 Transport Agent is recommended or allowed - I have see a one line statement that creation of threads is not recommended.

    2) I am storing the asynccontext, args and src and smtpserver information in a static structure and accessing these values from the individual worker threads. Will this cause problems if I try to access them from the separate threads?

    3) Finally, I want to launch a number of long term threads at the first instantiation of the transport Agent factory and subsequent calls will to instantiate the factory will create additional worker threads. All these threads will access the information stored in a static variables associated with the factory (see point 2).
    These variables will be used to create new messages based on original messages arriving and also modify the incoming messages i.e. using the asynccontext, args and src and smtpserver. So the question is whether access the routingAgent information is possible from threads that have been invoked from different calls to instantiate the RoutingAgentFactory.


    Wednesday, April 18, 2012 1:51 PM

All replies

  • Hi A,

    And welcome to the world of routing agents.

    1) Yes it is allowed. In fact there's sample code in the TA SDK that shows how to do it.

    2) Hmmm... Yes you can store them and yes can access the data but your messages won't continue to process unless you signal you've completed working with them (important) and once you notify Exchange you're done you can't access the message information again (very important). Also, note that Exchange can only process so many messages at once.

    3) Yes you can launch threads from the factory and yes it's kewl to have them access static data in the factory and it's also ok to create new messages. As for that last bit it's hard to say w/o seeing more details of what you're planning but I'd be very careful and again I'd recommend you use the sample code as a guide.


    Scott Quinn | C# developer & messaging specialist (for hire). Contact me at http://au.linkedin.com/in/scottquinn

    Wednesday, April 18, 2012 4:26 PM