initialize queues with 'NullProcessor'

This commit is contained in:
Peter Hormanns 2023-08-01 19:27:49 +02:00
parent 977c9225b7
commit 52b5d74561
16 changed files with 65 additions and 887 deletions

View File

@ -5,7 +5,7 @@
<groupId>de.hsadmin</groupId>
<artifactId>hsar</artifactId>
<packaging>war</packaging>
<version>4.0.9</version>
<version>4.0.10</version>
<name>HSAdmin Stable Backend Webapp</name>
<url>http://maven.apache.org</url>
<properties>
@ -36,12 +36,12 @@
<dependency>
<groupId>de.hsadmin.core</groupId>
<artifactId>hsadmin-util</artifactId>
<version>4.0.9</version>
<version>4.0.10</version>
</dependency>
<dependency>
<groupId>de.hsadmin.core</groupId>
<artifactId>hsadmin-qserv</artifactId>
<version>4.0.9</version>
<version>4.0.10</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>

View File

@ -1,155 +0,0 @@
package de.hsadmin.servlets;
import java.io.IOException;
import java.io.PrintWriter;
import javax.jms.ExceptionListener;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueReceiver;
import javax.jms.QueueSession;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import de.hsadmin.core.model.TechnicalException;
import de.hsadmin.core.model.Transaction;
import de.hsadmin.core.qserv.Processor;
import de.hsadmin.core.qserv.QueueTask;
import de.hsadmin.core.util.Config;
import de.hsadmin.mods.pac.Pac;
import de.hsadmin.mods.pac.PacProcessorFactory;
public class PacTasksServlet extends HttpServlet
implements MessageListener, ExceptionListener {
private static final long serialVersionUID = -5701350884034782083L;
private String jmsUser;
private String jmsPass;
private QueueConnectionFactory queueConnectionFactory;
private QueueConnection queueConnection;
private QueueSession queueSession;
private boolean isConnected;
private int messageCount;
private int errorCount;
@Override
public void init() throws ServletException {
isConnected = false;
messageCount = 0;
errorCount = 0;
try {
connect();
} catch (NamingException e) {
throw new ServletException(e);
}
}
private void connect() throws NamingException {
Config config = Config.getInstance();
jmsUser = config.getProperty("hsadmin.jms.username", "hsadmin");
jmsPass = config.getProperty("hsadmin.jms.password", "hsadmin-pw");
InitialContext ctx = new InitialContext();
Context env = (Context) ctx.lookup("java:comp/env");
queueConnectionFactory = (QueueConnectionFactory) env.lookup("jms/QueueCF");
while (!isConnected) {
try {
queueConnection = queueConnectionFactory.createQueueConnection(jmsUser, jmsPass);
queueConnection.setExceptionListener(this);
queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
Queue queue = (Queue) env.lookup("jms/hsadminSystem-pactasks");
queueConnection.start();
QueueReceiver receiver = queueSession.createReceiver(queue);
receiver.setMessageListener(this);
isConnected = true;
} catch (JMSException e) {
close();
try {
Thread.sleep(2000);
} catch (InterruptedException e1) { }
}
}
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
resp.setContentType("text/plain");
PrintWriter writer = resp.getWriter();
writer.println("Verbindungsstatus: " + (isConnected ? "OK" : "ERROR"));
writer.println("Verarbeitete Nachrichten: " + messageCount);
writer.println("Verarbeitungsfehler: " + errorCount);
writer.close();
}
@Override
public void destroy() {
close();
}
private void close() {
try { if (queueSession != null) queueSession.close(); } catch (JMSException e) { }
try { if (queueConnection != null) queueConnection.close(); } catch (JMSException e) { }
isConnected = false;
}
@Override
public void onMessage(Message jmsMessage) {
Transaction transaction = null;
messageCount++;
try {
final TextMessage txtMessage = (TextMessage) jmsMessage;
final String message = txtMessage.getText();
System.out.println(message);
final String[] parts = message.split(":");
transaction = new Transaction("pactasks");
transaction.beginTransaction();
final EntityManager em = transaction.getEntityManager();
final Query qPac = em.createQuery("SELECT p FROM Pacs p WHERE p.name = :name");
qPac.setParameter("name", parts[1]);
final Pac pac = (Pac) qPac.getSingleResult();
final PacProcessorFactory factory = new PacProcessorFactory();
Processor proc = null;
if ("pac.add".equals(parts[0])) {
proc = factory.createCreateProcessor(em, pac);
}
if ("pac.update".equals(parts[0])) {
proc = factory.createUpdateProcessor(em, pac);
}
if ("pac.delete".equals(parts[0])) {
proc = factory.createDeleteProcessor(em, pac);
}
transaction.enqueue(pac.getHiveName(), new QueueTask(pac.owningUser(em), parts[0] + ":" + parts[1], message, proc));
em.clear();
em.flush();
transaction.commitTransaction();
} catch (Exception e) {
errorCount++;
if (transaction != null) transaction.rollbackTransaction();
throw new TechnicalException(e);
} finally {
if (transaction != null) transaction.close();
}
}
@Override
public void onException(JMSException exception) {
close();
try { Thread.sleep(10000); } catch (InterruptedException e) { }
try { connect(); } catch (NamingException e) { }
}
}

View File

@ -2,6 +2,7 @@ package de.hsadmin.servlets;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Set;
import javax.jms.ExceptionListener;
import javax.jms.JMSException;
@ -16,6 +17,8 @@ import javax.jms.QueueSession;
import javax.jms.Session;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NameClassPair;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.persistence.EntityManager;
import javax.servlet.ServletConfig;
@ -24,9 +27,13 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.command.ActiveMQQueue;
import de.hsadmin.core.model.TechnicalException;
import de.hsadmin.core.model.TicketValidator;
import de.hsadmin.core.model.Transaction;
import de.hsadmin.core.qserv.NullProcessor;
import de.hsadmin.core.qserv.Processor;
import de.hsadmin.core.qserv.QueueTask;
import de.hsadmin.core.util.Config;
@ -66,6 +73,24 @@ public class QueueStatusReceiverServlet extends HttpServlet
jmsUser = config.getProperty("hsadmin.jms.username", "hsadmin");
jmsPass = config.getProperty("hsadmin.jms.password", "hsadmin-pw");
InitialContext ctx = new InitialContext();
NamingEnumeration<NameClassPair> list = ctx.list("java:comp/env/jms");
Transaction transaction = new Transaction("anonymous");
transaction.beginTransaction();
EntityManager entityManager = transaction.getEntityManager();
while (list.hasMore()) {
NameClassPair pair = list.next();
String jndiName = pair.getName();
if (jndiName != null && jndiName.startsWith("hsadminSystem-")) {
QueueTask task = new QueueTask();
task.setProcessor(new NullProcessor());
entityManager.persist(task);
entityManager.flush();
String hive = jndiName.substring(14);
transaction.enqueue(hive, task);
}
}
transaction.commitTransaction();
transaction.close();
Context env = (Context) ctx.lookup("java:comp/env");
queueConnectionFactory = (QueueConnectionFactory) env.lookup("jms/QueueCF");
int timeoutCounter = 10;
@ -73,6 +98,9 @@ public class QueueStatusReceiverServlet extends HttpServlet
try {
queueConnection = queueConnectionFactory.createQueueConnection(jmsUser, jmsPass);
queueConnection.setExceptionListener(this);
if (queueConnection instanceof ActiveMQConnection) {
checkQueues((ActiveMQConnection) queueConnection, new PrintWriter(System.out));
}
queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
Queue queue = (Queue) env.lookup("jms/hsadminStatus");
queueConnection.start();
@ -89,6 +117,19 @@ public class QueueStatusReceiverServlet extends HttpServlet
}
}
private void checkQueues(ActiveMQConnection amqConn, PrintWriter writer) {
try {
writer.print("\n");
Set<ActiveMQQueue> queues = amqConn.getDestinationSource().getQueues();
for (ActiveMQQueue queue : queues) {
writer.print("Phys: " + queue.getPhysicalName() + " - Qual: " + queue.getQualifiedName() + "\n");
}
} catch (JMSException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
@ -97,6 +138,9 @@ public class QueueStatusReceiverServlet extends HttpServlet
writer.println("Verbindungsstatus: " + (isConnected ? "OK" : "ERROR"));
writer.println("Verarbeitete Nachrichten: " + messageCount);
writer.println("Verarbeitungsfehler: " + errorCount);
if (queueConnection instanceof ActiveMQConnection) {
checkQueues((ActiveMQConnection) queueConnection, writer);
}
writer.close();
}

View File

@ -30,9 +30,4 @@
global="jms/hsadminStatus"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-pactasks"
global="jms/hsadminSystem-pactasks"
type="javax.jms.Queue"/>
</Context>

View File

@ -1,38 +0,0 @@
<Context path="/hsar" reloadable="true" crossContext="true">
<ResourceLink
name="jdbc/HSAdminDB"
global="jdbc/HSAdminDB"
type="javax.sql.DataSource"/>
<ResourceLink
name="jms/QueueCF"
global="jms/QueueCF"
type="javax.jms.QueueConnectionFactory"/>
<ResourceLink
name="jms/hsadminSystem-h99"
global="jms/hsadminSystem-h99"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-testmail"
global="jms/hsadminSystem-testmail"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-testdns"
global="jms/hsadminSystem-testdns"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminStatus"
global="jms/hsadminStatus"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-pactasks"
global="jms/hsadminSystem-pactasks"
type="javax.jms.Queue"/>
</Context>

View File

@ -1,598 +0,0 @@
<Context path="/hsar" reloadable="true" crossContext="true">
<ResourceLink
name="jdbc/HSAdminDB"
global="jdbc/HSAdminDB"
type="javax.sql.DataSource"/>
<ResourceLink
name="jms/QueueCF"
global="jms/QueueCF"
type="javax.jms.QueueConnectionFactory"/>
<ResourceLink
name="jms/hsadminSystem-h01"
global="jms/hsadminSystem-h01"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h02"
global="jms/hsadminSystem-h02"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h03"
global="jms/hsadminSystem-h03"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h04"
global="jms/hsadminSystem-h04"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h05"
global="jms/hsadminSystem-h05"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h06"
global="jms/hsadminSystem-h06"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h07"
global="jms/hsadminSystem-h07"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h08"
global="jms/hsadminSystem-h08"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h09"
global="jms/hsadminSystem-h09"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h10"
global="jms/hsadminSystem-h10"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h11"
global="jms/hsadminSystem-h11"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h12"
global="jms/hsadminSystem-h12"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h13"
global="jms/hsadminSystem-h13"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h14"
global="jms/hsadminSystem-h14"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h15"
global="jms/hsadminSystem-h15"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h16"
global="jms/hsadminSystem-h16"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h17"
global="jms/hsadminSystem-h17"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h18"
global="jms/hsadminSystem-h18"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h19"
global="jms/hsadminSystem-h19"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h20"
global="jms/hsadminSystem-h20"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h21"
global="jms/hsadminSystem-h21"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h22"
global="jms/hsadminSystem-h22"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h23"
global="jms/hsadminSystem-h23"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h24"
global="jms/hsadminSystem-h24"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h25"
global="jms/hsadminSystem-h25"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h26"
global="jms/hsadminSystem-h26"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h27"
global="jms/hsadminSystem-h27"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h28"
global="jms/hsadminSystem-h28"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h29"
global="jms/hsadminSystem-h29"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h30"
global="jms/hsadminSystem-h30"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h31"
global="jms/hsadminSystem-h31"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h32"
global="jms/hsadminSystem-h32"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h33"
global="jms/hsadminSystem-h33"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h34"
global="jms/hsadminSystem-h34"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h35"
global="jms/hsadminSystem-h35"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h36"
global="jms/hsadminSystem-h36"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h37"
global="jms/hsadminSystem-h37"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h38"
global="jms/hsadminSystem-h38"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h39"
global="jms/hsadminSystem-h39"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h40"
global="jms/hsadminSystem-h40"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h41"
global="jms/hsadminSystem-h41"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h42"
global="jms/hsadminSystem-h42"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h43"
global="jms/hsadminSystem-h43"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h44"
global="jms/hsadminSystem-h44"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h45"
global="jms/hsadminSystem-h45"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h46"
global="jms/hsadminSystem-h46"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h47"
global="jms/hsadminSystem-h47"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h48"
global="jms/hsadminSystem-h48"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h49"
global="jms/hsadminSystem-h49"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h50"
global="jms/hsadminSystem-h50"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h51"
global="jms/hsadminSystem-h51"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h52"
global="jms/hsadminSystem-h52"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h53"
global="jms/hsadminSystem-h53"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h54"
global="jms/hsadminSystem-h54"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h55"
global="jms/hsadminSystem-h55"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h56"
global="jms/hsadminSystem-h56"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h57"
global="jms/hsadminSystem-h57"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h58"
global="jms/hsadminSystem-h58"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h59"
global="jms/hsadminSystem-h59"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h60"
global="jms/hsadminSystem-h60"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h61"
global="jms/hsadminSystem-h61"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h62"
global="jms/hsadminSystem-h62"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h63"
global="jms/hsadminSystem-h63"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h64"
global="jms/hsadminSystem-h64"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h65"
global="jms/hsadminSystem-h65"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h66"
global="jms/hsadminSystem-h66"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h67"
global="jms/hsadminSystem-h67"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h68"
global="jms/hsadminSystem-h68"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h69"
global="jms/hsadminSystem-h69"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h70"
global="jms/hsadminSystem-h70"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h71"
global="jms/hsadminSystem-h71"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h72"
global="jms/hsadminSystem-h72"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h73"
global="jms/hsadminSystem-h73"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h74"
global="jms/hsadminSystem-h74"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h75"
global="jms/hsadminSystem-h75"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h76"
global="jms/hsadminSystem-h76"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h77"
global="jms/hsadminSystem-h77"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h78"
global="jms/hsadminSystem-h78"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h79"
global="jms/hsadminSystem-h79"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h80"
global="jms/hsadminSystem-h80"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h81"
global="jms/hsadminSystem-h81"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h82"
global="jms/hsadminSystem-h82"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h83"
global="jms/hsadminSystem-h83"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h84"
global="jms/hsadminSystem-h84"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h85"
global="jms/hsadminSystem-h85"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h86"
global="jms/hsadminSystem-h86"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h87"
global="jms/hsadminSystem-h87"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h88"
global="jms/hsadminSystem-h88"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h89"
global="jms/hsadminSystem-h89"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h90"
global="jms/hsadminSystem-h90"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h91"
global="jms/hsadminSystem-h91"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h92"
global="jms/hsadminSystem-h92"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h93"
global="jms/hsadminSystem-h93"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h94"
global="jms/hsadminSystem-h94"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h95"
global="jms/hsadminSystem-h95"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h96"
global="jms/hsadminSystem-h96"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h97"
global="jms/hsadminSystem-h97"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h98"
global="jms/hsadminSystem-h98"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-h99"
global="jms/hsadminSystem-h99"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-vm1101"
global="jms/hsadminSystem-vm1101"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-vm1102"
global="jms/hsadminSystem-vm1102"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-vm1103"
global="jms/hsadminSystem-vm1103"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-vm1104"
global="jms/hsadminSystem-vm1104"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-vm1105"
global="jms/hsadminSystem-vm1105"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-vm1106"
global="jms/hsadminSystem-vm1106"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-vm1107"
global="jms/hsadminSystem-vm1107"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-vm1108"
global="jms/hsadminSystem-vm1108"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-vm1109"
global="jms/hsadminSystem-vm1109"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-vm1110"
global="jms/hsadminSystem-vm1110"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-mail1"
global="jms/hsadminSystem-mail1"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-mail2"
global="jms/hsadminSystem-mail2"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-mail3"
global="jms/hsadminSystem-mail3"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-dns1"
global="jms/hsadminSystem-dns1"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-dns2"
global="jms/hsadminSystem-dns2"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-dns3"
global="jms/hsadminSystem-dns3"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminStatus"
global="jms/hsadminStatus"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-pactasks"
global="jms/hsadminSystem-pactasks"
type="javax.jms.Queue"/>
</Context>

View File

@ -1,38 +0,0 @@
<Context path="/hsar" reloadable="true" crossContext="true">
<ResourceLink
name="jdbc/HSAdminDB"
global="jdbc/HSAdminDB"
type="javax.sql.DataSource"/>
<ResourceLink
name="jms/QueueCF"
global="jms/QueueCF"
type="javax.jms.QueueConnectionFactory"/>
<ResourceLink
name="jms/hsadminSystem-h99"
global="jms/hsadminSystem-h99"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-testmail"
global="jms/hsadminSystem-testmail"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-testdns"
global="jms/hsadminSystem-testdns"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminStatus"
global="jms/hsadminStatus"
type="javax.jms.Queue"/>
<ResourceLink
name="jms/hsadminSystem-pactasks"
global="jms/hsadminSystem-pactasks"
type="javax.jms.Queue"/>
</Context>

View File

@ -22,12 +22,6 @@
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>Queue PacTasks Servlet</servlet-name>
<servlet-class>de.hsadmin.servlets.PacTasksServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>XmlRpcServlet</servlet-name>
<servlet-class>de.hsadmin.remote.HSXmlRpcServlet</servlet-class>
@ -57,11 +51,6 @@
<url-pattern>/xmlrpc/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Queue PacTasks Servlet</servlet-name>
<url-pattern>/queuePacTasks</url-pattern>
</servlet-mapping>
<resource-ref>
<res-ref-name>jdbc/HSAdminDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
@ -99,11 +88,5 @@
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
<resource-ref>
<res-ref-name>jms/hsadminSystem-pactasks</res-ref-name>
<res-type>javax.jms.Queue</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</web-app>

View File

@ -3,8 +3,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.hsadmin</groupId>
<artifactId>hsadmin-qserv</artifactId>
<version>4.0.9</version>
<artifactId>hsadmin-deploy</artifactId>
<version>4.0.10</version>
<packaging>jar</packaging>
<name>HSAdmin-QServ</name>
@ -20,7 +20,7 @@
<dependency>
<groupId>de.hsadmin.core</groupId>
<artifactId>hsadmin-qserv</artifactId>
<version>4.0.9</version>
<version>4.0.10</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
@ -89,15 +89,6 @@
<filemode>640</filemode>
</mapper>
</data>
<data>
<src>src/deb/etc/keystore</src>
<type>file</type>
<mapper>
<type>perm</type>
<prefix>/etc/hsadmin/qserv</prefix>
<filemode>640</filemode>
</mapper>
</data>
<data>
<src>src/deb/systemd/hsadmin-qserv.service</src>
<type>file</type>

Binary file not shown.

View File

@ -6,7 +6,7 @@ After=network.target nss-lookup.target
Type=simple
Environment="PATH=/usr/local/bin:/usr/bin:/bin"
Environment="JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64"
Environment="JAVA_OPTS=-Xbootclasspath/a:/etc/hsadmin/qserv/ -Djavax.net.ssl.keyStore=/etc/hsadmin/qserv/keystore -Djavax.net.ssl.keyStorePassword=password -Djavax.net.ssl.trustStore=/etc/hsadmin/qserv/keystore -Djavax.net.ssl.trustStorePassword=password -Dorg.apache.activemq.SERIALIZABLE_PACKAGES=java.lang,javax.security,java.util,org.apache.activemq,org.fusesource.hawtbuf,com.thoughtworks.xstream.mapper,de.hsadmin.core.qserv,de.hsadmin.mods.cust,de.hsadmin.mods.db,de.hsadmin.mods.dom,de.hsadmin.mods.email,de.hsadmin.mods.pac,de.hsadmin.mods.qstat,de.hsadmin.mods.user"
Environment="JAVA_OPTS=-Xbootclasspath/a:/etc/hsadmin/qserv/ -Djavax.net.ssl.keyStore=/etc/hsadmin/qserv/keystore -Djavax.net.ssl.keyStorePassword=password -Djavax.net.ssl.trustStore=/etc/hsadmin/qserv/truststore -Djavax.net.ssl.trustStorePassword=password -Dorg.apache.activemq.SERIALIZABLE_PACKAGES=java.lang,javax.security,java.util,org.apache.activemq,org.fusesource.hawtbuf,com.thoughtworks.xstream.mapper,de.hsadmin.core.qserv,de.hsadmin.mods.cust,de.hsadmin.mods.db,de.hsadmin.mods.dom,de.hsadmin.mods.email,de.hsadmin.mods.pac,de.hsadmin.mods.qstat,de.hsadmin.mods.user"
ExecStart=/usr/bin/java $JAVA_OPTS -jar /usr/local/lib/hostsharing/hsadmin/hsadmin-qserv-full.jar /etc/hsadmin/qserv/qserv.properties
StandardOutput=file:/var/log/hostsharing/hsadmin/hsar-qserv.err
StandardError=inherit

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.hsadmin.core</groupId>
<artifactId>hsadmin-qserv</artifactId>
<version>4.0.9</version>
<version>4.0.10</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>11</java.version>
@ -13,7 +13,7 @@
<dependency>
<groupId>de.hsadmin.core</groupId>
<artifactId>hsadmin-util</artifactId>
<version>4.0.9</version>
<version>4.0.10</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>

View File

@ -12,7 +12,6 @@ import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.persistence.EntityManager;
import javax.persistence.EntityTransaction;
import javax.persistence.Query;
import org.apache.openjpa.persistence.OpenJPAEntityManager;
@ -83,20 +82,14 @@ public class Transaction {
taskStore.add(task);
}
private void sendAll(EntityTransaction transaction) {
boolean firstHive = true;
private void sendAll() {
for (String hive : taskStores.keySet()) {
QueueTaskStore store = taskStores.get(hive);
String queueName = "hsadminSystem-" + hive;
// queueName = "hsadminSystem-h99"; // FIXME nicht committen !!!
Queue jmsSystemQueue = lookupJMSQueue(queueName);
QueueClient qClient = null;
try {
qClient = new QueueClient(queueConnectionFactory, jmsSystemQueue);
if (firstHive) {
firstHive = false;
transaction.commit();
}
for (QueueTask task : store.getTasks()) {
qClient.send(task);
}
@ -107,13 +100,6 @@ public class Transaction {
if (qClient != null) qClient.close();
}
}
if (firstHive) {
try {
transaction.commit();
} catch (Exception e) {
throw new TechnicalException(e);
}
}
}
public void beginTransaction() {
@ -122,7 +108,8 @@ public class Transaction {
}
public void commitTransaction() {
sendAll(entityManager.getTransaction());
sendAll();
entityManager.getTransaction().commit();
transactionActive = false;
}

View File

@ -84,7 +84,7 @@ public class QueueServer extends QueueCommons implements MessageListener, Except
}
});
while (!qServ.connect()) {
Thread.sleep(10000);
Thread.sleep(120000);
}
while (true) {
Thread.sleep(10000);

View File

@ -67,6 +67,13 @@ public class QueueTask extends AbstractEntity implements Serializable {
private String exception;
public QueueTask() {
this.user = null;
this.title = "ping";
this.details = null;
this.started = new Date();
this.finished = null;
this.proc = null;
this.exception = null;
}
public QueueTask(UnixUser user, String title, String details, Processor proc) {

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.hsadmin.core</groupId>
<artifactId>hsadmin-util</artifactId>
<version>4.0.9</version>
<version>4.0.10</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>11</java.version>