You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by ageannopoulos <gi...@git.apache.org> on 2017/05/09 12:22:02 UTC
[GitHub] qpid-jms pull request #6: Added two new example classes, Client and Server.
GitHub user ageannopoulos opened a pull request:
https://github.com/apache/qpid-jms/pull/6
Added two new example classes, Client and Server.
These classes allow the user to input some messages, which can be sent to the server, manipulated, and then returned to the client.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/ageannopoulos/qpid-jms client_server_additions
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/qpid-jms/pull/6.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #6
----
commit 7bd681339e322b0b776684211fb1a26c70760ab3
Author: Austin Geannopoulos <au...@gmail.com>
Date: 2017-05-08T17:35:08Z
Added two new example classes, Client and Server
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
[GitHub] qpid-jms pull request #6: Added two new example classes, Client and Server.
Posted by gemmellr <gi...@git.apache.org>.
Github user gemmellr commented on a diff in the pull request:
https://github.com/apache/qpid-jms/pull/6#discussion_r115540862
--- Diff: qpid-jms-examples/src/main/java/org/apache/qpid/jms/example/Server.java ---
@@ -0,0 +1,119 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.jms.example;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.DeliveryMode;
+import javax.jms.Destination;
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.ObjectMessage;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import java.util.ArrayList;
+import java.util.Collections;
+
+public class Server {
+
+ public static void main(String[] args) throws Exception {
+ System.out.println("[SERVER] Awaiting Message...");
+
+ try {
+ // The configuration for the Qpid InitialContextFactory has been supplied in
+ // a jndi.properties file in the classpath, which results in it being picked
+ // up automatically by the InitialContext constructor.
+ Context context = new InitialContext();
+
+ ConnectionFactory factory = (ConnectionFactory) context.lookup("myFactoryLookup");
+ Destination queue = (Destination) context.lookup("myQueueLookup");
+
+ Connection connection = factory.createConnection(System.getProperty("USER"), System.getProperty("PASSWORD"));
+ connection.setExceptionListener(new MyExceptionListener());
+ connection.start();
+
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+
+ MessageConsumer messageConsumer = session.createConsumer(queue);
+ while (true) {
+
+ long start = System.currentTimeMillis();
+
+ //Receive a message
+ Message receivedMessage = messageConsumer.receive(0);
--- End diff --
Removing the 0 might be clearer, using the plain receive() call.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
[GitHub] qpid-jms pull request #6: Added two new example classes, Client and Server.
Posted by gemmellr <gi...@git.apache.org>.
Github user gemmellr commented on a diff in the pull request:
https://github.com/apache/qpid-jms/pull/6#discussion_r115539336
--- Diff: qpid-jms-examples/src/main/java/org/apache/qpid/jms/example/Client.java ---
@@ -0,0 +1,204 @@
+
+package org.apache.qpid.jms.example;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.DeliveryMode;
+import javax.jms.Destination;
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TemporaryQueue;
+import javax.jms.TextMessage;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Scanner;
+
+public class Client {
+ private static final int DELIVERY_MODE = DeliveryMode.NON_PERSISTENT;
+ public static void main(String[] args) throws Exception {
+ try {
+ // The configuration for the Qpid InitialContextFactory has been supplied in
+ // a jndi.properties file in the classpath, which results in it being picked
+ // up automatically by the InitialContext constructor.
+ Context context = new InitialContext();
+
+ ConnectionFactory factory = (ConnectionFactory) context.lookup("myFactoryLookup");
+ Destination queue = (Destination) context.lookup("myQueueLookup");
+
+ Connection connection = factory.createConnection(System.getProperty("USER"), System.getProperty("PASSWORD"));
+ connection.setExceptionListener(new MyExceptionListener());
+ connection.start();
+
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ //Create message and temporary queue to send to and from.
+ Message messageToBeSent = userInterface(session);
+ TemporaryQueue tempQ = session.createTemporaryQueue();
+ messageToBeSent.setJMSReplyTo(tempQ);
+
+ MessageProducer messageProducer = session.createProducer(queue);
+
+ //Send the message
+ messageProducer.send(messageToBeSent, DELIVERY_MODE, Message.DEFAULT_PRIORITY, Message.DEFAULT_TIME_TO_LIVE);
+ System.out.println("[CLIENT] The message has been sent.");
+
+
+ MessageConsumer messageConsumer = session.createConsumer(tempQ);
+ long start = System.currentTimeMillis();
+ boolean deductTimeout = false;
+ int timeout = 1000;
+
+ //Receive the server response
+ TextMessage newMessage = (TextMessage) messageConsumer.receive(timeout);
+ if (newMessage != null) {
+ System.out.print("[CLIENT] Response from server received in ");
+ } else {
+ System.out.println("[CLIENT] Response not received within timeout, stopping.");
+ deductTimeout = true;
+ }
+
+ long finish = System.currentTimeMillis();
+ long taken = finish - start;
+ if (deductTimeout) {
+ taken -= timeout;
+ }
+ if (newMessage != null) {
+ System.out.println(taken + "ms");
--- End diff --
I would probably just remove the timing stuff. The Sender+Reciever examples only have that as they can serve as simple throughput checks, it isnt likely to be that interesting in this case.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
[GitHub] qpid-jms pull request #6: Added two new example classes, Client and Server.
Posted by gemmellr <gi...@git.apache.org>.
Github user gemmellr commented on a diff in the pull request:
https://github.com/apache/qpid-jms/pull/6#discussion_r115542360
--- Diff: qpid-jms-examples/src/main/java/org/apache/qpid/jms/example/Server.java ---
@@ -0,0 +1,119 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.jms.example;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.DeliveryMode;
+import javax.jms.Destination;
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.ObjectMessage;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import java.util.ArrayList;
+import java.util.Collections;
+
+public class Server {
+
+ public static void main(String[] args) throws Exception {
+ System.out.println("[SERVER] Awaiting Message...");
+
+ try {
+ // The configuration for the Qpid InitialContextFactory has been supplied in
+ // a jndi.properties file in the classpath, which results in it being picked
+ // up automatically by the InitialContext constructor.
+ Context context = new InitialContext();
+
+ ConnectionFactory factory = (ConnectionFactory) context.lookup("myFactoryLookup");
+ Destination queue = (Destination) context.lookup("myQueueLookup");
+
+ Connection connection = factory.createConnection(System.getProperty("USER"), System.getProperty("PASSWORD"));
+ connection.setExceptionListener(new MyExceptionListener());
+ connection.start();
+
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+
+ MessageConsumer messageConsumer = session.createConsumer(queue);
+ while (true) {
+
+ long start = System.currentTimeMillis();
+
+ //Receive a message
+ Message receivedMessage = messageConsumer.receive(0);
+
+ long finish = System.currentTimeMillis();
+ long taken = finish - start;
+
+ System.out.println("[SERVER] Received the message in " + taken + "ms");
+
+ //Create new message to return to client
+ Destination replyDestination = receivedMessage.getJMSReplyTo();
+ TextMessage newMessage = session.createTextMessage(interpretMessage(receivedMessage));
+ MessageProducer messageProducer = session.createProducer(null);
+ newMessage.setJMSDestination(replyDestination);
--- End diff --
This line should be removed. It doesnt actually have any effect on where the message goes, and is not intended for application usage, but is rather an annoying and confusing element of JMS, where many setter methods on the Message exist only for the client itself to use during the send call when supplied with another JMS providers messages.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
[GitHub] qpid-jms pull request #6: Added two new example classes, Client and Server.
Posted by ageannopoulos <gi...@git.apache.org>.
Github user ageannopoulos closed the pull request at:
https://github.com/apache/qpid-jms/pull/6
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
[GitHub] qpid-jms pull request #6: Added two new example classes, Client and Server.
Posted by gemmellr <gi...@git.apache.org>.
Github user gemmellr commented on a diff in the pull request:
https://github.com/apache/qpid-jms/pull/6#discussion_r115538757
--- Diff: qpid-jms-examples/src/main/java/org/apache/qpid/jms/example/Client.java ---
@@ -0,0 +1,204 @@
+
+package org.apache.qpid.jms.example;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.DeliveryMode;
+import javax.jms.Destination;
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TemporaryQueue;
+import javax.jms.TextMessage;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Scanner;
+
+public class Client {
+ private static final int DELIVERY_MODE = DeliveryMode.NON_PERSISTENT;
+ public static void main(String[] args) throws Exception {
+ try {
+ // The configuration for the Qpid InitialContextFactory has been supplied in
+ // a jndi.properties file in the classpath, which results in it being picked
+ // up automatically by the InitialContext constructor.
+ Context context = new InitialContext();
+
+ ConnectionFactory factory = (ConnectionFactory) context.lookup("myFactoryLookup");
+ Destination queue = (Destination) context.lookup("myQueueLookup");
+
+ Connection connection = factory.createConnection(System.getProperty("USER"), System.getProperty("PASSWORD"));
+ connection.setExceptionListener(new MyExceptionListener());
+ connection.start();
+
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
--- End diff --
This line and most of the other 'empty' lines below actually have leading whitespace that should be removed. The 'git diff' command can be configured to show this whitespace if it isnt already, as can most IDE's (which can also typically format the code and remove them, either on request or automatically).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
[GitHub] qpid-jms pull request #6: Added two new example classes, Client and Server.
Posted by gemmellr <gi...@git.apache.org>.
Github user gemmellr commented on a diff in the pull request:
https://github.com/apache/qpid-jms/pull/6#discussion_r115537587
--- Diff: qpid-jms-examples/src/main/java/org/apache/qpid/jms/example/Client.java ---
@@ -0,0 +1,204 @@
+
+package org.apache.qpid.jms.example;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.DeliveryMode;
+import javax.jms.Destination;
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TemporaryQueue;
+import javax.jms.TextMessage;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Scanner;
+
+public class Client {
+ private static final int DELIVERY_MODE = DeliveryMode.NON_PERSISTENT;
+ public static void main(String[] args) throws Exception {
--- End diff --
Nice to have a line between variables and methods.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
[GitHub] qpid-jms issue #6: Added two new example classes, Client and Server.
Posted by gemmellr <gi...@git.apache.org>.
Github user gemmellr commented on the issue:
https://github.com/apache/qpid-jms/pull/6
Hi Austin,
I think this is a good start. There are some changes that I think would improve the new example classes, in general I think the classes would benefit from some simplification in terms of a making a clear messaging example. They effectively combine to give a request-response example, so for me the main things are to demonstrate the use of a [Temporary]Queue for responses and using JMSReplyTo to pass that destination information to the server and for it to use that in sending responses back.
For example, consider the equivalent Client and Server examples for Proton's C++ and Python bindings:
https://github.com/apache/qpid-proton/blob/master/examples/python/client.py
https://github.com/apache/qpid-proton/blob/master/examples/python/server.py
https://github.com/apache/qpid-proton/blob/master/examples/cpp/client.cpp
https://github.com/apache/qpid-proton/blob/master/examples/cpp/server.cpp
These look (I haven't actually run them) to just send some fixed messages with well-known request text, and capitalize them on the server before sending the responses. I think doing the same here too would make for a clearer example, showing just the bits people need to know about the client config etc to get started and the messaging pattern in general, without the added complexity of commands and reading input expanding the scope.
If we strip the example back to just send/receive basic text messages like the Proton ones, it should even be possible to run the different examples in combination fairly easily. That might take a little more work, so I'm not suggeting you need to do that here, just commenting on it perhaps being a 'nice to have' some time, and aligning the behaviour more here would make sense as a starting point to the end. The main complication I can think of in actually doing it would be that right now the JMS client examples use a queue named "queue" by default whereas the Proton ones use "examples" by default. The Proton ones do let you specify the details on the command line, so that would be one way to align them (the other being updating the JMS clients jndi.properties file before compiling them). I don't see a need for adding that complexity here, but I would be happy to change the JMS examples default queue name config in jndi.properties to match. Again, I'm not suggesting you need to d
o that here though, we can always do that separately later.
Beyond the above, I noted some very small issues looking this over which would apply even with the simplifications, I'll go put some comments against the code now.
Robbie
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
[GitHub] qpid-jms pull request #6: Added two new example classes, Client and Server.
Posted by gemmellr <gi...@git.apache.org>.
Github user gemmellr commented on a diff in the pull request:
https://github.com/apache/qpid-jms/pull/6#discussion_r115541734
--- Diff: qpid-jms-examples/src/main/java/org/apache/qpid/jms/example/Server.java ---
@@ -0,0 +1,119 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.jms.example;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.DeliveryMode;
+import javax.jms.Destination;
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.ObjectMessage;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import java.util.ArrayList;
+import java.util.Collections;
+
+public class Server {
+
+ public static void main(String[] args) throws Exception {
+ System.out.println("[SERVER] Awaiting Message...");
+
+ try {
+ // The configuration for the Qpid InitialContextFactory has been supplied in
+ // a jndi.properties file in the classpath, which results in it being picked
+ // up automatically by the InitialContext constructor.
+ Context context = new InitialContext();
+
+ ConnectionFactory factory = (ConnectionFactory) context.lookup("myFactoryLookup");
+ Destination queue = (Destination) context.lookup("myQueueLookup");
+
+ Connection connection = factory.createConnection(System.getProperty("USER"), System.getProperty("PASSWORD"));
+ connection.setExceptionListener(new MyExceptionListener());
+ connection.start();
+
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+
+ MessageConsumer messageConsumer = session.createConsumer(queue);
+ while (true) {
+
+ long start = System.currentTimeMillis();
+
+ //Receive a message
+ Message receivedMessage = messageConsumer.receive(0);
+
+ long finish = System.currentTimeMillis();
+ long taken = finish - start;
+
+ System.out.println("[SERVER] Received the message in " + taken + "ms");
+
+ //Create new message to return to client
+ Destination replyDestination = receivedMessage.getJMSReplyTo();
+ TextMessage newMessage = session.createTextMessage(interpretMessage(receivedMessage));
+ MessageProducer messageProducer = session.createProducer(null);
--- End diff --
MessageProducer instances need to be closed when you are finished using them, this would currently be orphaning some resources each time. You also typically create a long-lived anoynmous MessageProducers, so as to re-use them. If you move the creation outside the while loop, you can then reuse a single producer for sending all the subsequent responses.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
[GitHub] qpid-jms pull request #6: Added two new example classes, Client and Server.
Posted by gemmellr <gi...@git.apache.org>.
Github user gemmellr commented on a diff in the pull request:
https://github.com/apache/qpid-jms/pull/6#discussion_r115540310
--- Diff: qpid-jms-examples/src/main/java/org/apache/qpid/jms/example/Server.java ---
@@ -0,0 +1,119 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.qpid.jms.example;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.DeliveryMode;
+import javax.jms.Destination;
+import javax.jms.ExceptionListener;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.jms.ObjectMessage;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import java.util.ArrayList;
+import java.util.Collections;
+
+public class Server {
+
+ public static void main(String[] args) throws Exception {
+ System.out.println("[SERVER] Awaiting Message...");
--- End diff --
If this line is left, it would probably be better in the while loop before the receive call that might block indefinitely.
There are also some tabs here and in many of the other lines below, which should be replaced with spaces. As before, git diff and IDEs can help here.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
[GitHub] qpid-jms issue #6: Added two new example classes, Client and Server.
Posted by tabish121 <gi...@git.apache.org>.
Github user tabish121 commented on the issue:
https://github.com/apache/qpid-jms/pull/6
Agree with Robbie on this one, in general if your example requires more than a couple minutes for the reader to digest then you start to lose them. Syncing up with the other examples listed seems like a nice to have goal with interoperability between them being a great final outcome from this.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
[GitHub] qpid-jms pull request #6: Added two new example classes, Client and Server.
Posted by gemmellr <gi...@git.apache.org>.
Github user gemmellr commented on a diff in the pull request:
https://github.com/apache/qpid-jms/pull/6#discussion_r115537215
--- Diff: qpid-jms-examples/src/main/java/org/apache/qpid/jms/example/Client.java ---
@@ -0,0 +1,204 @@
+
--- End diff --
This new file needs a licence header added.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org