TemporaryQueue communication - Request/Response messaging in JMS
Not able to make simple JMS application with the following steps run
Start the Server
Start the Client
The Client creates a temporary queue and sends the name to the server
Server receives message and sends a test message back.
Client NEVER receives the test message
Can someone provide me appropriate sample example in this regard. Using "oc4j_extended_101320"
Thanks
sunder
Note the server recives the request and logs the message
but client doesnt consume the message.
Here is client code
package project1;
import java.rmi.*;
import java.util.*;
import javax.jms.Connection;
import javax.jms.JMSException;
import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageListener;
import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.QueueConnection;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueSender;
import javax.jms.QueueSession;
import javax.jms.Session;
import javax.jms.TemporaryQueue;
import javax.jms.TextMessage;
import javax.naming.*;
public class TestClient {
private QueueSender sender;
private Session session;
private Connection connection;
private MessageConsumer consumer;
private MessageProducer producer;
* Constructor: Setup JMS for publishing
public TestClient() {
try {
Context ctx = getInitialContext();
System.out.print("env " + ctx.getEnvironment());
QueueConnectionFactory conFactory =
(QueueConnectionFactory) ctx.lookup("jms/QueueConnectionFactory");
Queue chatQueue = (Queue) ctx.lookup("jms/TestQueue");
// Create a JMS connection
connection = conFactory.createConnection();
// Create a JMS session object
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
TemporaryQueue replyQueue = session.createTemporaryQueue();
TextMessage textMsg = session.createTextMessage();
textMsg.setText( "How r u dude!!!!!!!");
textMsg.setJMSReplyTo(replyQueue);
textMsg.setJMSExpiration(40000l);
System.out.println("\nsender 1 ========== >>>>> " + replyQueue.getQueueName());
consumer = session.createConsumer(replyQueue);
System.out.println("sender 2========== >>>>> " + replyQueue.getQueueName());
System.out.println("sender 2a========== >>>>> \n" + textMsg.getJMSMessageID() +"\n");
System.out.println("sender 2b========== >>>>> \n" + textMsg.getJMSCorrelationID() +"\n");
producer = (MessageProducer) session.createProducer(chatQueue);
producer.send(textMsg);
System.out.println("sender 3a========== >>>>> \n" + textMsg.getJMSMessageID() +"\n");
System.out.println("sender 3b========== >>>>> \n" + textMsg.getJMSCorrelationID() +"\n");
} catch(Exception e) {
e.printStackTrace();
finally {
* Method: sendmail(Map mail)
public void sendmail() throws Exception {
Message respmessage = (TextMessage )consumer.receive();
System.out.println("sender 3========== >>>>> " + ((TextMessage)respmessage).getText());
private Context getInitialContext() throws NamingException {
Properties env = new Properties();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.evermind.server.rmi.RMIInitialContextFactory");
env.put("java.naming.provider.url", "ormi://localhost");
env.put("java.naming.security.principal", "oc4jadmin");
env.put("java.naming.security.credentials", "welcome1");
return new InitialContext(env);
* Static Method: java com.customware.client.EmailClient to_addr [from_addr] [subject] [body]
public static void main(String args[]) throws Exception {
System.out.println("\nBeginning EmailClient\n");
TestClient client = new TestClient();
client.sendmail();
MDB code
package project2;
import javax.ejb.CreateException;
import javax.ejb.EJBException;
import javax.ejb.MessageDrivenBean;
import javax.ejb.MessageDrivenContext;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.ConnectionFactory;
import javax.jms.Connection;
import javax.jms.MapMessage;
import javax.jms.TextMessage;
public class MessageDrivenEJBBean implements MessageDrivenBean,
MessageListener {
private MessageDrivenContext _context;
private javax.jms.ConnectionFactory connectionFactory;
private javax.sql.DataSource dataSource;
public void ejbCreate() throws CreateException {
dataSource = ResourceFactory.getInstance().getPricingDS();
//java:comp/env/jdbc/PricingDS
connectionFactory = ResourceFactory.getInstance().getPricingRespQueueCF();
public void setMessageDrivenContext(MessageDrivenContext context) throws EJBException {
_context = context;
public void ejbRemove() throws EJBException {
public void onMessage(Message message) {
TextMessage msg = null;
Connection connection = null;
try {
if (message instanceof TextMessage) {
msg = (TextMessage) message;
System.out.println
("Dood Message "
+ msg.getText());
connection = connectionFactory.createConnection();
Destination replyDest = message.getJMSReplyTo();
System.out.println
("Dood Reply Queue "
+ msg.getJMSReplyTo());
String replyMsgId = msg.getJMSMessageID();
Session session = connection.createSession(true, 0);
System.out.println("Creating producer!!!!!!!!"+ replyDest);
System.out.println("Creating consumer!!!!!!!! ID\n\n"+ replyMsgId);
System.out.println("Creating consumer!!!!!!!!COR ID\n\n"+ msg.getJMSCorrelationID());
MessageProducer producer = session.createProducer(replyDest);
TextMessage replyMsg = session.createTextMessage();
replyMsg.setText("Response Message!!!!!!!! Good Job" );
replyMsg.setJMSCorrelationID(replyMsgId);
producer.send(replyMsg);
System.out.println("Creating producer!!!!!!!!ID\n\n"+ replyMsg.getJMSMessageID());
System.out.println("Creating producer!!!!!!!!COR ID\n\n"+ replyMsg.getJMSCorrelationID());
producer.close();
session.close();
} else {
System.out.println
("Message of wrong type: "
+ message.getClass().getName());
} catch (Throwable te) {
te.printStackTrace();
finally {
try{
if(connection!=null)
connection.close();
} catch(Exception e) {
Message was edited by:
user565613
You created a transacted session on the server, and then never committed the transaction. Since the transaction was not committed before the session was closed, it is automatically rolled back as per the JMS spec. Either call commit on the session or use a non-transacted session (e.g., use session-creation paramters of "false, Session.AUTO_ACKNOWLEDGE").
-Jeff
Similar Messages
-
Implementing synchronous request response behaviour with JMS
i have a requirement wherein i send a list of tasks to be executed (this has to be executed in parallel so taking the JMS route) and should wait for the results of al these tasks. How could i do this with JMS? I need JMS since the originally these tasks was being done using threading and since in j2ee it is not advisable to spawn threads we are planning to use JMS so that we can have concurrency that is done by the container. can someone please tell how can i simulate this synchronous request-response paradigm using JMS?
It may not be great idea however possibility of State full session bean can be explored.
State full session bean will send all 100 tasks to JMS queue without waiting for the result. There will be another JMS program (Say ResponseCollector) which will listen on queue for all responses. Once ResponseCollector collects all the responses, it will trigger the state full session bean again.
You can use some properties in JMS header to discriminate between the request and response on same queue and apply the message selector. -
How to implement request/response domain in JMS
hi friends,
I need help regarding implementing request/response domain
in jms.please help me.See the TopicRequestor and QueueRequestor helper classes in the JMS API.
FWIW there's a POJO based request/response implementation using JMS here...
http://lingo.codehaus.org
you might find the source code useful as it does efficient request/response in a highly concurrent way using JMS under the covers.
James
http://logicblaze.com/ -
ESB Console turns Request/Response message into One Way message
Hi folks,
have come across a strange situation and wondered if anyone else had come across this. Maybe it's fixed as part of a patch set.
I'm running SOA Suite 10.1.3.1.0 on Windows.
After I've created and deployed a Request/Response service (either RS or SOAP Invocation Service) if I go to the ESB Console and click on "Apply" in say the Definition tab, my service turns into a One Way service.
This then causes null pointer exceptions when I run my process, as you might expect.
If I redeploy from JDev and leave the "Apply" button alone I'm back in business.
Is this something that anyone else has had a problem with?Hi.
I would recommend you to install version 10.1.3.3 of SOA Suite
http://download.oracle.com/otn/nt/ias/10133/ias_windows_x86_101330.zip
http://download.oracle.com/otn/linux/ias/10133/ias_linux_x86_101330.zip
Also, use the JDev 10.1.3.3
http://www.oracle.com/technology/software/products/jdev/htdocs/soft10133.html
They are supposed to be much more stable.
After using the new release, let us know if you still run into this problem.
Denis -
Loging request/response messages of WS
Hi,
I got Java WS generated from WSDL and PL/SQL in JDeveloper 10g. I need to log request and response messasges, for example in DB table as CLOB. How could I get request and response of WS in xml (SOAP format)? I use 10g DB.
I'm provider of this WS, Logic of this WS is in PLSQL package.
Can you help me?
G.
Edited by: Gocoo on 9.8.2012 10:22Hi Damien,
SALT 11g only supports SOAP/HTTP(S), so the payload must be in XML format. SALT 12.1.3 adds support for RESTful services that can use either XML or JSON payloads.
Regards,
Todd Little
Oracle Tuxedo Chief Architect -
Request and Response Scenario for JMS adapter
Hi,
I am working on IDOC-XI-JMS, JMS(sender)- XI - JMS (receiver)scenario and this is going to be real time. If any record is update in customer master then that record will be sent to JMS provider MQ series and lock the record in the legacy system and then legacy system unlock and send back a message that this has been unlocked.
This would be request response message, anyone tell me how this can be achived. I think I may have to use BPM for this kind of processing. Can anyone tell me the steps to achive the BPM for such processing.
Regards
Please reply back
Edited by: hema Mehta on May 23, 2008 2:05 AMHi Hema,
Reward points if this helps
Step by Step Porcess of JMS Synchronous Scenario without BPM: Correlation Settings and Transactional JMS Session
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b028f6f6-7da5-2a10-19bd-cf322cf5ae7b
How To Correlate JMS Messages
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8060448a-e56e-2910-f588-9af459e7ce21
Async/Sync Communication using JMS adapter without BPM
/people/sudheer.babu2/blog/2007/01/18/asyncsync-communication-using-jms-adapter-without-bpm-sp-19
STEPS in BPM for synchornous.
Reward points if this helps
Regards
Pragathi. -
SOAP sender Adapter - response message missing in adapter engine level
Hi,
We have a synchronous scenario SOAP<-> P I <--->Proxy .Request comes from web service get the response from ECC.
Issue reported that response message not reached the web service .
I am able to see the request & response messages in SXMB_MONI. To check the status in message monitoring through RWB synch message are not existing more than a day.
Is there any possibility of failure of messages at adapter engine level in this case? If so How can I get error log?
what are the settings required to make the synchronous messages available in RWB?
Thanks in advance,
Regards,
Kartikeyawhat are the settings required to make the synchronous messages available in RWB?
Set messaging.syncMessageRemover.removeBody = false in NWA / Visual Admin. Have a look at the below link for details -
/people/william.li/blog/2008/02/07/display-adapter-synchronous-message-content-in-rwb-of-pi-71
Regards,
TK -
XML Namespace in WebService Request/Response
Hi all,
I have a question regarding xml namespace usage in wsdl and the corresponding request/response messages.
I have already browsed quite some articles about xml namespaces as well as some forum threads, but I am still not sure.
I have the following part of a wsdl document (generated by Integration Directory), defining a targetnamespace.
u2026
<wsdl:types>
<xsd:schema targetNamespace="http://www.dorma.com/sap/xi/finance"
xmlns="http://www.dorma.com/sap/xi/finance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="DebtorGetDetailResponse" type="Z_BAPI_DEBTOR_GETDETAIL_Response"></xsd:element>
u2026
<xsd:complexType name="Z_BAPI_DEBTOR_GETDETAIL_Response">
<xsd:sequence>
<xsd:element name="DEBITOR_COMPANY_DETAIL" type="BAPI1007_5" minOccurs="0">
</xsd:element> u2026
</xsd:sequence>
</xsd:complexType>
u2026
</xsd:schema>
u2026
</wsdl:types>
u2026
In my understanding, all types defined in the schema section of a wsdl document will be in the targetnamespace, if defined.
Therefore the element DEBITOR_COMPANY_DETAIL would be in the namesapce
http://www.dorma.com/sap/xi/finance
However, the ABAP proxy generates a response message like follows,
where only the root element is in this namespace and the child elements are in the global namespace:
<?xml version="1.0" encoding="utf-8"?>
<ns1:DebtorGetDetailResponse xmlns:ns1="http://www.dorma.com/sap/xi/finance"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<DEBITOR_COMPANY_DETAIL>
u2026
</DEBITOR_COMPANY_DETAIL>
u2026
</ns1:DebtorGetDetailResponse>
Do I have a wrong understand of the wsdl (xml schema) or is this an erroneous behavior?
The problem is that some 3rd-party software web service module does not accept
the response message as not complient with the respective wsdl document.
Any input is appreciated.
Thanks
Hans
Edited by: Hans-Jürgen Schwippert on Oct 1, 2008 12:02 PMI have the same problem. I am trying to connect to a webservice running on IBM websphere but it doesn't accept the xml in my request. It appears to be the same namespace issue.
Did you ever find a solution for this?
Is it a valid webservice call if you omit the namespace for an element or is this a bug in the Adaptive WS implementation?
Web Dynpro web service model generated request:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Header>
<sapsess:Session xmlns:sapsess="http://www.sap.com/webas/630/soap/features/session/">
<enableSession>true</enableSession>
</sapsess:Session>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
look between these lines -
<ns1:tamKontrolleraKontoLastAnrop xmlns:ns1="http://schemas.fora.se/modell/tam/1.0/TAM_Data">
<AnvandarNamn>30039647</AnvandarNamn>
</ns1:tamKontrolleraKontoLastAnrop>
look between these lines -
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
As you can see the tag
<AnvandarNamn>30039647</AnvandarNamn>
is missing a namespace.
It should be
<ns1:AnvandarNamn>30039647</ns1:AnvandarNamn>
Using a third part tool called Soapui i generate this request that works:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tam="http://schemas.fora.se/modell/tam/1.0/TAM_Data">
<soapenv:Header/>
<soapenv:Body>
<tam:tamKontrolleraKontoLastAnrop>
<tam:AnvandarNamn>30039647</tam:AnvandarNamn>
</tam:tamKontrolleraKontoLastAnrop>
</soapenv:Body>
</soapenv:Envelope> -
JMS Request - Response Correlation Not Working
Hello Experts -
I am new to OAG and hence seek your expert advice. Following is our use-case scenario:
1. OAG needs to push a sample XML Message to Weblogic Request JMS Queue. In the Request tab of "Routing to Messaging System filter" I set the CorrelationId
2. In the response tab wait for a timeout (I set to 600000 secs)
3. Retrieve Response from the Weblogic Response Queue
4. Send the Response back to the client
When i invoke the OAG policy, I am able to post the message to the Request Queue. For my testing purpose, I manually get the correlation id from the request message in the request queue and then populate the same in the response message correlation id field and post the same to the response queue.
Unfortunately I am not able to see the response back. Below is the log.
Any help is greatly appreciated.
Thanks!
Dibya
DEBUG 29/Jan/2015:23:38:55.677 [3220] handle type text/plain with factory class com.vordel.mime.Body$1
DEBUG 29/Jan/2015:23:38:55.677 [3220] Added converted message is added to the whiteboard
DEBUG 29/Jan/2015:23:38:55.677 [3220] } = 1, filter [Request Message on Queue(Set Message)]
DEBUG 29/Jan/2015:23:38:55.678 [3220] Filter [Request Message on Queue(Set Message)] completes in 1 milliseconds.
DATA 29/Jan/2015:23:38:55.678 [3220] LogManager logging {
DATA 29/Jan/2015:23:38:55.678 [3220] Logging at Success
DATA 29/Jan/2015:23:38:55.678 [3220] Calling write log on class com.vordel.log.trace.TraceLogger
DATA 29/Jan/2015:23:38:55.679 [3220] }
DEBUG 29/Jan/2015:23:38:55.679 [3220] run filter [Place Message on Weblogic Queue (Messaging system)] {
DEBUG 29/Jan/2015:23:38:55.893 [2300] start thread 10706770 in set "netsvc threadpool": count=11, busy=10, idle target=4, max=512
DEBUG 29/Jan/2015:23:38:56.388 [3220] Set Reply to on a named queue: TokenJMSModule!SMAIPO.ActiveSubscriptionResponse
DEBUG 29/Jan/2015:23:38:56.389 [3220] creating consumer from QueueSession
DEBUG 29/Jan/2015:23:38:56.758 [3220] cache com.vordel.circuit.jms.JMSProcessor$PoolContextCache@19c45da grows to 3
DEBUG 29/Jan/2015:23:38:56.759 [3220] JMSProcessor message ID is: Id-ef18cb542c01000000000000bcac40f9
DEBUG 29/Jan/2015:23:38:56.760 [3220] Creating JMS byte message using automime
DEBUG 29/Jan/2015:23:38:56.760 [3220] new buffered content factory 10674640
DEBUG 29/Jan/2015:23:38:56.760 [3220] buffered content 10674640, size=0/8
DEBUG 29/Jan/2015:23:38:56.761 [3220] [10674640] new chunk 10541538 from 10606CC8 to 10606DFE (310)
DATA 29/Jan/2015:23:38:56.761 [3220] new content stack 105488F8
DATA 29/Jan/2015:23:38:56.761 [3220] push source buffered onto 105488F8
DEBUG 29/Jan/2015:23:38:56.761 [3220] Setting reply to named queue
DEBUG 29/Jan/2015:23:38:56.761 [3220] setJMSMessageID: Id-ef18cb542c01000000000000bcac40f9
DEBUG 29/Jan/2015:23:38:56.761 [3220] setJMSCorrelationID: Id-ef18cb542c01000000000000bcac40f9
DEBUG 29/Jan/2015:23:38:56.762 [3220] Calling post JMS creation hook
DEBUG 29/Jan/2015:23:38:56.762 [3220] Post JMS creation hook completed
DEBUG 29/Jan/2015:23:38:56.762 [3220] Sending JMS message to TokenJMSModule!SMAIPO.ActiveSubscriptionRequest
DATA 29/Jan/2015:23:38:57.120 [3220] trace transaction
DEBUG 29/Jan/2015:23:38:57.121 [3220] Wait for repsonse ? true
DEBUG 29/Jan/2015:23:38:57.819 [2300] incoming call on interface localhost:8085 from ::1:63317
DEBUG 29/Jan/2015:23:38:57.820 [2300] new connection 02F0FB08, settings source incoming interface (allow 1.1=no, idleTimeout=60000, activeTimeout=60000, contentLength: req=no, res=no)
DEBUG 29/Jan/2015:23:38:57.820 [2300] push SSL protocol on to connection
DATA 29/Jan/2015:23:38:57.820 [2300] [SSL_accept, 00006000] before/accept initialization.
DEBUG 29/Jan/2015:23:38:57.821 [2300] No SSL host name provided, defaulting to certificate: { subject: /CN=instance-1 }.
DATA 29/Jan/2015:23:38:57.821 [2300] [SSL_accept, 00002110] SSLv3 read client hello A.
DATA 29/Jan/2015:23:38:57.821 [2300] [SSL_accept, 00002130] SSLv3 write server hello A.
DATA 29/Jan/2015:23:38:57.823 [2300] [SSL_accept, 000021D0] SSLv3 write change cipher spec A.
DATA 29/Jan/2015:23:38:57.823 [2300] [SSL_accept, 000021E0] SSLv3 write finished A.
DATA 29/Jan/2015:23:38:57.823 [2300] [SSL_accept, 00002100] SSLv3 flush data.
DATA 29/Jan/2015:23:38:57.824 [2300] [SSL_accept, 000021C0] SSLv3 read finished A.
DEBUG 29/Jan/2015:23:38:57.825 [2300] negotiated SSL cipher "DHE-RSA-AES256-SHA", session 00000000 (reused) peer cert /CN=nodemanager-1
DATA 29/Jan/2015:23:38:57.825 [2300] client certificate: { subject: /CN=nodemanager-1 }
DEBUG 29/Jan/2015:23:38:57.826 [30a4] incoming call on interface localhost:8085 from 127.0.0.1:63320
DATA 29/Jan/2015:23:38:57.826 [2300] rcv 979 from max of 2048: <GET /api/monitoring/metrics/summary?timeline=10m&metricGroupType=Service HTTP/1.1
Host: localhost:8085
Accept: application/json
Accept-Language: en-US,en;q=0.8
authentication.subject.id: admin
authentication.subject.role: API Server Operator:API Service Developer:Policy Developer:API Service Administrator:API Server Administrator:Deployer:KPS Administrator
Authorization: Basic YWRtaW46Y2hhbmdlbWU=
Cookie: avlastvisit=1411930906; avlastactivity=0; __utma=125953885.1884274842.1414410173.1414410173.1417627152.2; __utmz=125953885.1417627152.2.2.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); utag_main=_st:1417668298258$ses_id:1417666771075%3Bexp-session; WT_FPC=id=cfc9b752-08a3-4756-8d26-c4ca2d77219f:lv=1417670100029:ss=1417670100029
Host: localhost:8085
Referer: https://xx1211000592.global.avaya.com:8090/
User-Agent: Gateway
X-Requested-With: XMLHttpRequest
Connection: close
X-CorrelationID: Id-f118cb54e204000000000000373fba90 1Hi Michael,
I think the adapter type is for the receiver channel looking at the documentation SAP Library - SAP Exchange Infrastructure
Have you checked your receiver channel doesn't belong to a party?
I havent tried this bridge with the http_aae but looks to be problematic according with Michal comment here http://scn.sap.com/community/pi-and-soa-middleware/blog/2014/01/28/generic-pi-async-sync-bridge-configuration-for-any-adapters#comment-454463
Regards. -
How to notify the exceptions in JMS sychronous request-response processing?
Hi All,
Pl. help me with ur expertise in the foll. scenario we are facing.
Scenario:
I have a requirement where I need to notify the exceptions to my client while
the client request's are processed asynchronously and my client is waiting in
synchronous for the response.
The client is sending a message to one queue (QueueA) and waiting for response
in another queue (QueueB). The message from "QueueA" is picked up by a MDB listening
to "QueueA" and it throws an exception while processing some "business logic".
In this case how do I notify to my client who is waiting in another queue. i.e.
"QueueB" that there is an exception occurred while processing the business logic.
I am using JMSCorrelationID to uniquely identify a response for a request sent
by the client.
What are the possible options to handle exceptions in JMS for an implementation
like the one mentioned above.
Any comments/feedback/pointers will be REALLY REALLY appreciated.
Tks and regds
C R Baradwaj
Raghuram Bharadwaj C wrote:
> Tom,
>
> Once again thanks a lot for your prompt response!
>
> Yes, A Knows how many downstream queues are involved.
>
> For unanticipated multiple responses
>
> If I do a select for update in all the MDB's listening to "QueueB/QueueC/QueueD",
> only one response message will be sent to the "ResponseQ".
Does this run the risk of serializing the database access? If
B/C/D have no messages so that a new operation causes all
three to fire at once, will they end up serializing on their
respective selectForUpdate calls, losing parallelism?
>
> The response from all the datasource(s) are updated in the database by the MDB.
> The MDB which updates the database last will consolidate all the response(s) and
> send one final response to the "ResponseQ".
>
> This will be picked up the client who is waiting in the "ResponseQ". There wont
> be multiple message(s) placed in the "ResponseQ".
>
> In this situation, How do I handle exceptions that occur in downstream MDB's?
Use multiple responses. MDB's send error message on response.
Or have failing MDB put an error message in the database table, so
that the final responder can read the error message?
>
> Many Thanks in Advance,
> C R Baradwaj
>
>
>
>
>
>
>
>
>
>
> Tom Barnes <[email protected]> wrote:
>
>>
>>Raghuram Bharadwaj C wrote:
>>
>>>Thanks tom for your support!
>>>
>>>Let me explain more about the problem.
>>>
>>>Scenario
>>>========
>>>Lets take a simplest case where the client is sending a message to
>>
>>"QueueA" and
>>
>>>he is now waiting for a response in the "ResponseQ"
>>>
>>>The MDB listening to "QueueA" wakes up and split the message(s) into
>>
>>three and
>>
>>>passing it to the next layer of datasource specific queue(s). The queue(s)
>>
>>are
>>
>>>"QueueB", "QueueC" and "QueueD".
>>>
>>>The MDB listening to the datasource specific queue(s) picks up the
>>
>>datasource
>>
>>>request sends it to the datasource and gets the response back from
>>
>>the datasource.
>>
>>>The MDB also updates a table in the database with the response. The
>>
>>MDB also check(s)
>>
>>>after updating the database to see all response(s) from all the datasource(s)
>>>are reached. If yes, one of the MDB also sends a acknowledgement to
>>
>>the "ResponseQ".
>>
>>>
>>>The client listening to the "ResponseQ" gets the acknowledgement and
>>
>>hit the database
>>
>>>to collect all the response(s) from all the datasource(s). These response(s)
>>
>>are
>>
>>>formatted and sent a response to the client. We have also created uniqueid
>>
>>for
>>
>>>identifying each request. This uniqueid is set in the JMSCorrelationID.
>>
>>The client
>>
>>>uses the uniqueid to collect all the response(s) for the request he
>>
>>had sent.
>>
>>>Problem
>>>=======
>>>If an error/exception occurred in a one of the MDB which is listening
>>
>>to QueueB/QueueC/QueueD.
>>
>>>How do we handle this?
>>>
>>>Please let me know all the possibilities that you would have done in
>>
>>this case.
>>
>>>
>>Does A know how many downstream queues are involved? As part of its
>>transaction it can send a message to the responseQ stating which
>>queues to expect responses from. The client gets this message
>>and knows that it must get responses from all of B, C, D, etc.
>>before assuming success. On a failure, B, C, D, etc. can send
>>an error message back to the response Q, or the client can
>>simply timeout.
>>
>>This way there are no race conditions
>>involving unanticipated multiple responses or missing
>>responses, which I think the
>>algorithm you mention above can create.
>>Assuming just B and C (no D):
>> B detects C is done by checking the DB
>> C detects B is done by checking the DB **at the same time**
>> Two response messages get sent
>> - or -
>> B finishes detects C not done, and sends no message.
>> C finishes, B is finished but not reflected in DB yet, sends
>> no message.
>>
>>NOTE: Be aware that when a transaction commits, different
>>resources can response "faster" than others. The transaction
>>monitor has no control over this. So, if as part of the
>>same commit, a database insert and a queue insert is
>>performed, it is possible for a consumer to receive the
>>new message BEFORE the new database insert actually completes.
>>
>>
>>>
>>>Many Thanks in Advance,
>>>
>>>C R Baradwaj
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>Assuming that
>>>
>>>Tom Barnes <[email protected]> wrote:
>>>
>>>
>>>>One approach is to send an "error" message to QB that uses
>>>>the JMSCorrelationID the consumer is expecting. This will
>>>>wake up the consumer, and the consumer can react to
>>>>the error as needed.
>>>>
>>>>Another is to use two asynchronous listeners, one on the
>>>>response queue, and one on a temporary (client created)
>>>>queue. On error detection the MDB can send error messages
>>>>to the temporary queue.
>>>>
>>>>You may want to skim the book "Professional JMS" - as I
>>>>recall, it contains a section on queueing design patterns.
>>>>
>>>>Tom
>>>>
>>>>Raghuram Bharadwaj C wrote:
>>>>
>>>>
>>>>
>>>>>Hi All,
>>>>>
>>>>>Pl. help me with ur expertise in the foll. scenario we are facing.
>>>>>
>>>>>Scenario:
>>>>>I have a requirement where I need to notify the exceptions to my client
>>>>
>>>>while
>>>>
>>>>
>>>>>the client request's are processed asynchronously and my client is
>>>>
>>>>waiting in
>>>>
>>>>
>>>>>synchronous for the response.
>>>>>
>>>>>The client is sending a message to one queue (QueueA) and waiting
>>
>>for
>>
>>>>response
>>>>
>>>>
>>>>>in another queue (QueueB). The message from "QueueA" is picked up
>>
>>by
>>
>>>>a MDB listening
>>>>
>>>>
>>>>>to "QueueA" and it throws an exception while processing some "business
>>>>
>>>>logic".
>>>>
>>>>
>>>>>In this case how do I notify to my client who is waiting in another
>>>>
>>>>queue. i.e.
>>>>
>>>>
>>>>>"QueueB" that there is an exception occurred while processing the
>>
>>business
>>
>>>>logic.
>>>>
>>>>
>>>>>I am using JMSCorrelationID to uniquely identify a response for a
>>
>>request
>>
>>>>sent
>>>>
>>>>
>>>>>by the client.
>>>>>
>>>>>What are the possible options to handle exceptions in JMS for an implementation
>>>>>like the one mentioned above.
>>>>>
>>>>>Any comments/feedback/pointers will be REALLY REALLY appreciated.
>>>>>
>>>>>Tks and regds
>>>>>C R Baradwaj
>>>>
>
-
Blocking Request/Response JMS model
Hi everyone !
I'm starting to write a JMS application and I'm having some doubt about the request/response model enabled by the replyTo() method and CorrelationID field. As far is I know JMS is intended to let the client be free from the server's response by posting it's message on the queue and start doing some other work. But supposing the client needs a response from the server(a MDB) after the processing of the message I wonder how would him receive this response, assuming there is a second queue for posting the response messages. Simply using the MessageConsumer.receive() the client will be blocked, killing all the purpose of the model(even with timeout). So I wonder, should I create a second MDB just to handle the response queue ? This would left me with an RPC message producer, a MDB Message consumer (of the request message), and a MDB Message consumer (on the response queue). Is this a normal approach or is there something better ?
Thank you !Simply using the MessageConsumer.receive() the client will be blocked, killing all the purpose of the model(even with timeout).
You have to send the message and wait for the response in two separate transactions. For example:
// Start create and send transaction
ctx.getUserTransaction().begin();
connection = connectionFactory.createQueueConnection();
connection.start();
session = connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
final Message request = // create message
final Queue tempQueue = session.createTemporaryQueue();
request.setJMSReplyTo(tempQueue);
final QueueSender sender = session.createSender(destination);
sender.send(request);
ctx.getUserTransaction().commit();
// End create and send transaction
// Start receive transaction
ctx.getUserTransaction().begin();
final QueueReceiver receiver = session.createReceiver(tempQueue);
final Message response = receiver.receive(TIMEOUT);
ctx.getUserTransaction().commit();
// End receive transaction
// process response -
JMS Transport, Transactional, asynchronous request-response
Hi again :)
I have weblogic web service with jms transport and have chosen session bean implementation.
I'm testing transactional processing now.
Required feature is to put getting request from queue and processing it in web service in one transaction.
During tests I have noticed that:
When I throw RuntimeException from my web service method the message doesn't come back to the queue.
When I try to sessionContext.setRollbackOnly(); I get an error
javax.ejb.EJBException: EJB Exception: : java.lang.IllegalStateException: [EJB:010158]Illegal attempt to call EJBContext.setRollbackOnly() from an EJB that was not participating in a transaction.
When I deploy web service I get the following warning:
<Warning> <EJB> <> <AdminServer> <[STANDBY] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1238752023176> <BEA-010212> <The EJB 'EventNotifierServiceEJB(Application: portal, EJBComponent: EventNotifierService-1.0-SNAPSHOT.jar)' contains at least one method without an explicit transaction attribute setting. The default transaction attribute of Supports will be used for the following methods: local[publish(package.PackageType)] >
And putting @TransactionAttribute(TransactionAttributeType.MANDATORY) doesn't change this.
So It seems that transactions doesn't work by default.
I turned on XA in my own jms connection factory used by web service but this didn't help.
Looking in weblogic documentation I have found the following sentences:
In (http://e-docs.bea.com/wls/docs103/webserv_adv_rpc/jmstransport.html)
"If you have specified that the Web Service you invoke using JMS transport also runs within the context of a transaction (in other words, the JWS file includes the @weblogic.jws.Transactional annotation), you must use asynchronous request-response when invoking the service. If you do not, a deadlock will occur and the invocation will fail."
In (http://e-docs.bea.com/wls/docs103/webserv_adv_rpc/asynch.html)
"The asynchronous request-response feature works only with HTTP; you cannot use it with the HTTPS or JMS transport."
For me these two sentences are in conflict.
Currently I'm trying to use just transactional annotation without asynchronous request-response but the risk of deadlocks doesn't sound good for me.
BTW I have Oneway annotation in my web service method, I'm not sure if this changes something.
I'll be grateful for any help in resolving this problem.
Edited by: user10930859 on Apr 3, 2009 3:49 AMHi Karthik-
You can link the corelation-id..
Make you third-party application to receive Message-id from JMSRequestQueue and send this message id as correlation-id to JMSResponseQueue. I guess it would work we have tried this as POC.
Regards,
Ramesh -
Asynchronous Request-Response in JMS using OSB 11g
Hi All,
I am using OSB11g.
I have a scenario where I want to post a request into a JMS requestQueue, and without waiting for the response, should continue posting messages into the queue.
The response will be posted by a third party into a JMS responseQueue.
How to go ahead with this scenario? Is there any way to link the request & response in asynchronous calls like this?
Thanks in advance!!
Regards,
KarthikHi Karthik-
You can link the corelation-id..
Make you third-party application to receive Message-id from JMSRequestQueue and send this message id as correlation-id to JMSResponseQueue. I guess it would work we have tried this as POC.
Regards,
Ramesh -
JMS Request/Response example
Hi
I am trying to implement a JMS Request/Response example on glassfish, but i am not getting the correct behaviour.
My code is below. I am sending a message to a queue and adding the setJMSReplyTo another queue. I call the recv.receive(10000); and wait for the messages to be received. But this call blocks the current thread and the MDB that i orginally sent the message to only gets executed after the recv.receive(10000); has timed out after 10 seconds.
Can someone confirm that my code is correct or am i doing something wrong?
Connection connection = null;
Session session = null;
String text = "hello";
try {
System.out.println("Sending " + text);
connection = searchDestFactory.createConnection();
session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer messageProducer = session.createProducer(searchDest);
TextMessage tm = session.createTextMessage();
tm.setText(text);
tm.setJMSReplyTo(destQueue);
messageProducer.send(tm);
System.out.println("Sent " + text);
MessageConsumer recv = session.createConsumer(destQueue);
connection.start();
Message m = recv.receive(10000);
tm = (TextMessage) m;
if(tm != null) System.out.println(tm.getText());
else System.out.println("No message replied");
} catch (JMSException ex) {
System.out.println(ex);
Thanks Glen
Edited by: glen_ on Jun 16, 2008 6:13 AM
Edited by: glen_ on Jun 16, 2008 6:13 AM
Edited by: glen_ on Jun 16, 2008 6:14 AMGlen,
I have never attempted to use the messaging service the way you have, namely a single instance as both sender and receiver, but I noticed that you do send the message before you register your Consumer. My first and easiest suggestion would be to simply move your consumer block (I would move both lines) above the producer block and try again.
If that attempt fails, I would implement a MessageListener, once again before the producer block and allow it to handle received messages (no need for recv.receive(10000);)
Example:
public class QueueMessageListener implements MessageListener {
public void onMessage(Message message) {
try {
System.out.println(String.format("From Glassfish: %s received a %s of type %s.", m_Queue.getQueueName(), message.getClass().getName(), message.getJMSType()));
System.out.println(printJMSMessage(message));
} catch (JMSException ex) {
//handle message here
}and somewhere before the producer block:
m_msgListener = new QueueMessageListener();
m_msgConsumer = m_Session.createConsumer(m_Queue);
m_msgConsumer.setMessageListener(m_msgListener);
m_Connection.start();I feel like I've done my good dead for the day :)
-Jerome BG -
Hi All,
We have a scenario of FTP-->PI---> Webservice. While triggering the data in the FTP, it is failing in the PI with the below error
SOAP: response message contains an error XIAdapter/PARSING/ADAPTER.SOAP_EXCEPTION - soap fault: Server was unable to read request. ---> There is an error in XML document (1, 447). ---> Input string was not in a correct format.
Can you please help?Hi Raja- It seems to be a data quality issue.
Check for the value @ 1447 position in the xml message that you are trying to send to web service..
may be a date filed/decimal value which is not in expected format.
Maybe you are looking for
-
Getting the table names in an MS Access database
Hi, I am new to JDBC and making a client/server application that updates a MS Access database through jdbc:odbc. I need to get a list of existing user tables in the db. I have found a great document on the net which has the code, however the code doe
-
Hi all, I have been using a PDF e-book version that comes with one of my school textbooks to read it on my mac, make annotations and such. I have always used Preview; I have never installed Adobe Reader. Today however when I opened the PDF using Prev
-
Re: Safari Keeps Quitting Unexpectedly
My Safari keeps quitting driving me crazy i am mac illiterate please help Process: Safari [758] Path: /Applications/Safari.app/Contents/MacOS/Safari Identifier: com.apple.Safari Version: 5.0.3 (5533.19.4) Build Info: WebBrowser-75331904~3 Code Type:
-
COLLECT with AT NEW and AT END OF....?
Hi Experts, I'm trying to use the collect statement withiin a at new and at end of loop as follows. DATA: BEGIN OF gt_item OCCURS 0, order TYPE order, quantity TYPE quantity, line_no TYPE line_no, END OF gt_item. DATA: BEGIN
-
Apple should start to listen to customer issues with disappearing content.
There are many threads with users experiencing missing downloads of tv shows. There is clearly something going on apples side here and really disappointed that no one has come forward and stated that we are aware of an issue and hope to have it fixed