null handling
This commit is contained in:
parent
35862c1c06
commit
0b3385a3e0
@ -1,27 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="optional" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="optional" value="true"/>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
<attribute name="test" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
|
||||||
</classpath>
|
|
1
qserv-test/.gitignore
vendored
1
qserv-test/.gitignore
vendored
@ -1 +0,0 @@
|
|||||||
/target/
|
|
@ -1,23 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>hsadmin-qserv-test</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
@ -1,3 +0,0 @@
|
|||||||
eclipse.preferences.version=1
|
|
||||||
encoding//src/main/java=UTF-8
|
|
||||||
encoding/<project>=UTF-8
|
|
@ -1,8 +0,0 @@
|
|||||||
eclipse.preferences.version=1
|
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
|
|
||||||
org.eclipse.jdt.core.compiler.compliance=11
|
|
||||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
|
||||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
|
|
||||||
org.eclipse.jdt.core.compiler.release=disabled
|
|
||||||
org.eclipse.jdt.core.compiler.source=11
|
|
@ -1,4 +0,0 @@
|
|||||||
activeProfiles=
|
|
||||||
eclipse.preferences.version=1
|
|
||||||
resolveWorkspaceProjects=true
|
|
||||||
version=1
|
|
@ -1,68 +0,0 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<groupId>de.hsadmin.core</groupId>
|
|
||||||
<artifactId>hsadmin-qserv-test</artifactId>
|
|
||||||
<version>4.0.16</version>
|
|
||||||
<properties>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
<java.version>11</java.version>
|
|
||||||
</properties>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>de.hsadmin.core</groupId>
|
|
||||||
<artifactId>hsadmin-util</artifactId>
|
|
||||||
<version>4.0.16</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>de.hsadmin.core</groupId>
|
|
||||||
<artifactId>hsadmin-qserv</artifactId>
|
|
||||||
<version>4.0.16</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-lang</groupId>
|
|
||||||
<artifactId>commons-lang</artifactId>
|
|
||||||
<version>2.6</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-net</groupId>
|
|
||||||
<artifactId>commons-net</artifactId>
|
|
||||||
<version>3.9.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.velocity</groupId>
|
|
||||||
<artifactId>velocity-engine-core</artifactId>
|
|
||||||
<version>2.3</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.openjpa</groupId>
|
|
||||||
<artifactId>openjpa</artifactId>
|
|
||||||
<version>3.2.2</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.activemq</groupId>
|
|
||||||
<artifactId>activemq-client</artifactId>
|
|
||||||
<version>5.17.5</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>junit</groupId>
|
|
||||||
<artifactId>junit</artifactId>
|
|
||||||
<version>4.13.2</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>3.11.0</version>
|
|
||||||
<configuration>
|
|
||||||
<source>11</source>
|
|
||||||
<target>11</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</project>
|
|
@ -1,71 +0,0 @@
|
|||||||
package de.hsadmin.qserv.test;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import javax.jms.JMSException;
|
|
||||||
import javax.jms.Message;
|
|
||||||
import javax.jms.MessageListener;
|
|
||||||
import javax.jms.ObjectMessage;
|
|
||||||
import javax.jms.Queue;
|
|
||||||
import javax.jms.QueueConnection;
|
|
||||||
import javax.jms.QueueReceiver;
|
|
||||||
import javax.jms.QueueSession;
|
|
||||||
|
|
||||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
|
||||||
|
|
||||||
import de.hsadmin.core.qserv.ProcessorException;
|
|
||||||
import de.hsadmin.core.qserv.TaskTransfer;
|
|
||||||
|
|
||||||
public class Pull implements MessageListener {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
ActiveMQConnectionFactory cxFact = new ActiveMQConnectionFactory("ssl://hsh02.hostsharing.net:61619");
|
|
||||||
try {
|
|
||||||
// QueueConnection qCx = cxFact.createQueueConnection("hsar", "");
|
|
||||||
QueueConnection queueConnect = cxFact.createQueueConnection("user-h98", "");
|
|
||||||
QueueSession session = queueConnect.createQueueSession(false, QueueSession.CLIENT_ACKNOWLEDGE);
|
|
||||||
Queue queue = session.createQueue("queue.hsadminSystem-h98");
|
|
||||||
QueueReceiver receiver = session.createReceiver(queue);
|
|
||||||
receiver.setMessageListener(new Pull());
|
|
||||||
queueConnect.start();
|
|
||||||
boolean doContinue = true;
|
|
||||||
while (doContinue) {
|
|
||||||
try {
|
|
||||||
Thread.sleep(2000L);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
doContinue = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
queueConnect.stop();
|
|
||||||
session.close();
|
|
||||||
queueConnect.close();
|
|
||||||
} catch (JMSException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onMessage(Message message) {
|
|
||||||
if (message instanceof ObjectMessage) {
|
|
||||||
try {
|
|
||||||
ObjectMessage objMesg = (ObjectMessage) message;
|
|
||||||
Serializable serializable = objMesg.getObject();
|
|
||||||
if (serializable instanceof TaskTransfer) {
|
|
||||||
TaskTransfer task = (TaskTransfer) serializable;
|
|
||||||
task.getProcessor().process();
|
|
||||||
}
|
|
||||||
} catch (ProcessorException | JMSException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
message.acknowledge();
|
|
||||||
} catch (JMSException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
package de.hsadmin.qserv.test;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import javax.jms.JMSException;
|
|
||||||
import javax.jms.Message;
|
|
||||||
import javax.jms.MessageProducer;
|
|
||||||
import javax.jms.Queue;
|
|
||||||
import javax.jms.QueueConnection;
|
|
||||||
import javax.jms.QueueSession;
|
|
||||||
|
|
||||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
|
||||||
|
|
||||||
import de.hsadmin.core.qserv.NullProcessor;
|
|
||||||
import de.hsadmin.core.qserv.TaskTransfer;
|
|
||||||
|
|
||||||
public class Push {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
ActiveMQConnectionFactory cxFact = new ActiveMQConnectionFactory("ssl://hsh02.hostsharing.net:61619");
|
|
||||||
try {
|
|
||||||
// QueueConnection qCx = cxFact.createQueueConnection("user-h98", "");
|
|
||||||
QueueConnection qCx = cxFact.createQueueConnection("hsar", "Eix4Baijee2ae1aighetaik8");
|
|
||||||
QueueSession session = qCx.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
|
|
||||||
Queue queue = session.createQueue("queue.hsadminSystem-h98");
|
|
||||||
MessageProducer producer = session.createProducer(queue);
|
|
||||||
Message message = session.createObjectMessage(new TaskTransfer(1L, "anonymous", new Date(), null, "hello world", "hello world detail", new NullProcessor(), null));
|
|
||||||
producer.send(queue, message);
|
|
||||||
session.close();
|
|
||||||
qCx.close();
|
|
||||||
} catch (JMSException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user