This content has been marked as final.
Show 4 replies
-
1. Re: Observes annotation in ejb 3.1 on fg3
psychollek Jan 7, 2010 1:52 PM (in response to psychollek)@Stateless public class AcountingEventListenerBean implements AcountingEventListenerRemote{ @Override public void listenToCreditUpdate(@Observes CreditUpdateEvent event){ } @Override public void listenOfferAdded(@Observes OfferAddedEvent evt){ } }
@Remote public interface AcountingEventListenerRemote { public void listenToCreditUpdate(CreditUpdateEvent event); public void listenOfferAdded(OfferAddedEvent evt); }
public class CreditUpdateEvent implements Serializable{ private static final long serialVersionUID = 768718676411L; private final long user; private final int amount; public CreditUpdateEvent(int amount, long user){ this.amount = amount; this.user = user; } public int getAmount() { return amount; } public long getUser(){ return user; } }
public class OfferAddedEvent implements Serializable { private static final long serialVersionUID = 168743443272735L; private final long userId; private final long offerId; public OfferAddedEvent(long userId,long offerId){ this.userId = userId; this.offerId = offerId; } public long getUserId() { return userId; } public long getOfferId() { return offerId; } }
-
2. Re: Observes annotation in ejb 3.1 on fg3
nickarls Jan 7, 2010 2:21 PM (in response to psychollek)https://jira.jboss.org/jira/browse/WELD-364
It is possible a leftover-restriction from a previous spec version.
-
3. Re: Observes annotation in ejb 3.1 on fg3
psychollek Jan 7, 2010 2:27 PM (in response to psychollek)bah, so I only need to change interface to local ? I thought only remote would work, as when I used nonexposed methods (which are local - accessible through no interface view)
-
4. Re: Observes annotation in ejb 3.1 on fg3
gavin.king Jan 7, 2010 7:26 PM (in response to psychollek)The spec says that producer/observer/disposer methods must be business methods of the EJB. Therefore, a method of a remote interface is acceptable. Apparently this is a bug in Weld. However, note that remote interfaces are not bean types of the EJB, so you can't inject an EJB that has only remote interfaces, unless you define it as a resource.