2013-08-21 2 views
0

을 인정하지 :JMS 메시지가 나는 오류를 인정하지이 메시지가 무엇입니까 오류

여기
javax.jms.IllegalStateException: Message not delivered 
at com.tibco.tibjms.TibjmsxSessionImp._confirmNonTransacted(TibjmsxSessionImp.java:3295) 
at com.tibco.tibjms.TibjmsxSessionImp._confirm(TibjmsxSessionImp.java:3644) 
at com.tibco.tibjms.TibjmsxSessionImp._confirmNonAuto(TibjmsxSessionImp.java:4980) 
at com.tibco.tibjms.TibjmsMessage.acknowledge(TibjmsMessage.java:609) 

내 코드입니다 :

public processMessage(Message pMessage){ 
    try{ 
     performOperation(); 
    } 
    catch(Exception e){ 
    }finally{ 
     if (pMessage != null) { 
      try { 
       pMessage.acknowledge(); 
      } catch (Exception e) { 
       try { 
        if (pMessage.getJMSRedelivered()) { 
         log.info("Message has been redelivered"); 
        } else 
         log.error(("Message has not been delivered"),e); 
       } catch (JMSException e1) { 
        log.error(e1); 
       } 
      } 
     } 
     return null; 
    } 

public boolean performOperation(somedata){ 
    try{ 
    insert into database 
    } 
    catch(DataIntegrityViolationException e){ 
     do something 
     if (pMessage != null){ 
     pMessage.acknowledge(); 
     } 
    } 
} 

    } 

답변

0

어떻게 당신이 JMS 세션을 만드는? 당신은 클라이언트가 비 트랜잭션 (transaction) 모드에서 인식 할, 그렇게 확신 세션이 다음과 같이 설정되어 있는지 확인 할 수 있습니다 또한

connection.createSession(false, Session.CLIENT_ACKNOWLEDGE); 

, 당신은 performOperation()이 실패 할 경우, 당신은을 인정하고 의미 finallymessage.acknowledge()을하고있는 메시지는 다른 시도를 위해 다시 전달되지 않음을 의미합니다. 메시지가 브로커 설정을 기반으로 재 전달됩니다 performOperation()의 실패에 따라이 곳과 같은 일을 생각해

public processMessage(Message pMessage){ 
    try{ 
     performOperation(); 
     pMessage.acknowledge(); 
    } 
    catch(Exception e){ 
    } 
+0

나는 JMS 세션이 생성되고 있는지 확실하지 않다, 나는 코드를 업데이트했다. APP에는 생산자와 소비자가 소품으로 구성되어 있습니다. – user1910892

+0

그건 작동하지 않을 것이다.'pMessage'는'processMessage()'의 범위에 있지 않다. 인자로 넘겨주지 않는다면 말이다. 모든 메시지 관련 작업을 확인하고 processMessage()에 유지해야합니다. – raffian

+0

pMessage를 인수로 전달하고 있습니다. 자세한 내용은 performOperation 메서드에서 다른 조건을 가지고 있으며 각 조건 후에는 인정하지만 각 성공적인 메시지에 대해서는 최종 승인을 사용하고 있습니다. – user1910892