Hi Pete,
Here is my Seam's component:
@Scope(ScopeType.APPLICATION)
| @Name("wcTickerPlant")
| @Startup
| @Restrict("#{identity.loggedIn}")
| public class TickerPlant {
| private Map<String, Quote> quotesMap = new ConcurrentHashMap<String,
Quote>();
| ...
|
| @Create
| public void refreshQuotes() {
| ....
| }
|
| @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
| public void updateFullQuote(FullQuote quote) {
| quotesMap.put(quote.getSymbol(), new Quote(quote));
| }
|
| ....
| }
And my MDB
@MessageDriven(activationConfig = {
| @ActivationConfigProperty(propertyName="destinationType",
propertyValue="javax.jms.Topic")
| , @ActivationConfigProperty(propertyName="destination",
propertyValue=ClientConfiguration.MARKET_DATA_TOPIC_NAME)
| // , @ActivationConfigProperty(propertyName="DLQMaxResent",
propertyValue="10")
| })
| @Name("quotesListener")
| public class QuoteBroadcastListener implements javax.jms.MessageListener {
| @Logger
| private Log logger;
|
| @In("wcTickerPlant")
| private TickerPlant tickerPlant;
|
| @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
| public void onMessage(Message msg) {
| if (msg == null || !(msg instanceof ObjectMessage)) {
| return;
| }
|
| if (logger != null) {
| logger.debug("Received message as=%1", msg);
| }
| Serializable payload = null;
| try {
| payload = ((ObjectMessage) msg).getObject();
| } catch (JMSException e) {
| if (logger != null) {
| logger.fatal("Unable to obtain payload in msg. Exception=",
e.getLocalizedMessage());
| }
| return;
| }
|
| // What type of object is it?
| if (payload instanceof FullQuoteBroadcastMessage) {
| FullQuoteBroadcastMessage fullQuoteMsg =
(FullQuoteBroadcastMessage) payload;
| FullQuote fullQuote = fullQuoteMsg.getFullQuote();
| tickerPlant.updateFullQuote(fullQuote);
| } else if (payload instanceof ...) {
| ...
| }
| }
| }
Let me know if you find anything wrong. Thanks again Pete.
-tony
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4078500#4078500
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4078500
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user