[EJB3] - Event Handling between two EJB-JARs (Observer Pattern?)
by Patrick M.
Patrick M. [https://community.jboss.org/people/patsinnervoice] created the discussion
"Event Handling between two EJB-JARs (Observer Pattern?)"
To view the discussion, visit: https://community.jboss.org/message/783044#783044
--------------------------------------------------------------
Hi,
I'm new to EJB development and currently search for the best/correct way to handle events between two EJB-JARs which are in one EAR.
I tried to use the Observer Pattern. The event gets fired in BeanA but does not reach BeanB (as stated, two different EJB-JARs = two different Eclipse Projects in one Workspace / EAR).
My Code currently looks kind of like this:
@DependsOn("BeanB")
@Startup
@Singleton
@WebService
public class BeanA implements BeanARemote, BeanBLocal{
@PersistenceContext
private EntityManager em;
@EJB
private BeanA beanA;
public void listenToReceivedEvent(@Observes ReceivedEvent events){
Query query = em.Query("some query");
//implementation
}
}
@Singleton
public class BeanB implements BeanBLocal {
@Inject
Event<ReceivedEvent> events;
public void fireEvent() {
//implementation
ReceivedEvent e = new ReceivedEvent(stringList);
event.fire(e);
}
}
public class ReceivedEvent {
private List<String> stringList;
public ReceivedEvent(final List<String> stringList) {
this.stringList= stringList;
}
public List<String> getStrings() {
return stringList;
}
}
Currently, when on BeanB the event is fired at BeanA nothing happens. My question now is: is the Observer Pattern the correct pattern in this case? Did I forgot something in this sample why the BeanA does not gets the event? Is the Observer Pattern made for event communication between two differen EJB-JARs?
Thanks
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/783044#783044]
Start a new discussion in EJB3 at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 6 months
[Beginner's Corner] - Deploying JDBC drivers and Datasources via jboss-cli.sh
by Willem Noorduin
Willem Noorduin [https://community.jboss.org/people/willemnoorduin] created the discussion
"Deploying JDBC drivers and Datasources via jboss-cli.sh"
To view the discussion, visit: https://community.jboss.org/message/779071#779071
--------------------------------------------------------------
In JBoss 7 / JBoss-EAP-6 I have made a domain-master (running on server1) and a slave (running on server2, and has server1 as its master. I have made a server-group and a server-config like this:
[domain@server1:9999 server-group] /server-group=one-server-group/:add(profile=full-ha,socket-binding-group=full-ha-sockets,jvm=default)
[domain@server1:9999 /] /host=server2/server-config=slave:add(auto-start=true, group=one-server-group, socket-binding-group=full-ha-sockets, socket-binding-port-offset=0)
[domain@server1:9999 /] /host=server2/server-config=slave:start
I would like deploy / add JDBC drivers and datasources via the cli, but:
[domain@server1:9999 subsystem=datasources] /host=server2/server=slave/subsystem=datasources/jdbc-driver=mysql:add(driver-name="mysql",driver-module-name="com.mysql.jdbc",driver-xa-datasource-class-name="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource")
Failed to get the list of the operation properties: "JBAS014753: There is no operation add registered at address [
("subsystem" => "datasources"),
("jdbc-driver" => "mysql")
]"
What do I do wrong. I can't reach the datasource subsystem of the master too, so I can't add it there either (of course, I can edit it manually to the domain.xml of the slave,, but then it still don't show up in my installed-drivers-list command.
Or do you have to define all drivers and datasources on the master ?
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/779071#779071]
Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 6 months
Fw: [Beginner's Corner] - Re: Twiddle queries
by vicky
Thanks erasmo2 for your prompt reply
I have already definedJAVA_HOME variable( using JDK 1.6.21) , is there any particular "jar" which i need to include to CLASSPATH variable for fixing the below TWIDDLE exception.
In my environment there are 5 jboss instances which are running on same machine & having same JNP port number.
I want to know that using TWIDDLE command how can we uniquely connect to each of the instance.
Please suggest i don't know much about it
Thanks
Vicky
________________________________
From: erasmo2 marciano2 <do-not-reply(a)jboss.com>
To: vicky sedfre <vicky007aggarwal(a)yahoo.co.in>
Sent: Monday, 10 December 2012 12:01 AM
Subject: [Beginner's Corner] - Re: Twiddle queries
JBoss Community
Re: Twiddle queries created by erasmo2 marciano2 in Beginner's Corner - View the full discussion
________________________________
Hi
1) I think that you need to install either the OpenJVM or the Sun/Oracle JVM, and then set JAVA_HOME to that JVM.
2) and 3) question
Example that you can use with twiddle
To get the active session count for your own app.
./twiddle.sh --user=admin --password=admin --server=127.0.0.1 get jboss.web:type=Manager,path=/jmx-console,host=localhost activeSessions
To retrieve the thread queue size
./twiddle.sh --user=admin --password=admin --server=127.0.0.1 get jboss.system:service=ThreadPool QueueSize
To retrieve active thread counts
./twiddle.sh --user=admin --password=admin --server=127.0.0.1 get jboss.system:type=ServerInfo ActiveThreadCount
To retrieve the amount of free memory
./twiddle.sh --user=admin --password=admin --server=127.0.0.1 get jboss.system:type=ServerInfo FreeMemory
To get all processing stats from the HTTP acceptor on JBoss
./twiddle.sh --user=admin --password=admin --server=127.0.0.1 get jboss.web:type=GlobalRequestProcessor,name=http-127.0.0.1-8080
Invoke a thread dump
./twiddle.sh --user=admin --password=admin --server=127.0.0.1 invoke jboss.system:type=ServerInfo listThreadDump
Invoke a listing of CPU utilization
./twiddle.sh --user=admin --password=admin --server=127.0.0.1 invoke jboss.system:type=ServerInfo listThreadCpuUtilization
Total System memory
./twiddle.sh --user=admin --password=admin --server=127.0.0.1 get jboss.system:type=ServerInfo TotalMemory
Active Thread Count
./twiddle.sh --user=admin --password=admin --server=127.0.0.1 get jboss.system:type=ServerInfo ActiveThreadCount
~ &
nbsp;
~
~
Reply to this message by going to Community
Start a new discussion in Beginner's Corner at Community
11 years, 6 months