[JBoss Seam] - Re: Calling Seam's component from MDB thew java.lang.Illegal
by tonylmai
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
18Â years, 8Â months
[JBoss Seam] - Re: s:link works, h:commandButton doesn't
by dkane
I've solved the problem myself, but still have questions.
There was h:selectOneMenu right before h:commandButton in my page.
h:selectOneMenu was mapped to the session-scoped Seam component, and dislayed the list of entities with s:convertEntity tag. But this field did not remember the selected value somehow. I.e each time I clicked s:link the selected value returned to first item in list.
I removed this h:selectOneMenu, and magically h:commandButton started to work !
After that, I digged tons of forum threads and found the thesis that s:convertEntities should work in conversation scope only. Found no word abot that in Seam manual, but adding long-running conversation @Begin(join="true") made h:selectOneMenu stateful (no more resets after form submission).
Then, I restored the original view of xhtml page : h:selectOneMenu and h:commandButton next . Everything works well.
Questions :
1) Is it possible, that incorrect processing of preceding JSF controls causes incorrect processing of following controls in the same page? (probably not pure Seam but JFS question)
2) Does s:convertEntities, indeed, require long-running conversation ? If so - why ?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4078493#4078493
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4078493
18Â years, 8Â months