JBOSS 4.2.2 메시지 대기열에서 메시지를 재현하는 방법 Retry가 만료 된 후
문제
JBoss 4.2.2 메시지 대기열에서 만료 된 메시지를 다시 만들 수있는 방법이 있습니까? 문제는 그들이 재시 도량을 초과했지만 이제 문제가 해결되었으므로 그것을 재현 할 수있는 방법이 있습니까?
Jboss 3에서는 이동할 수있는 텍스트 파일 일뿐입니다. 이제 데이터베이스에 저장되었으므로 어떻게 할 수 있습니까?
해결책 2
이것이 내가 한 일입니다.
Hashtable t = new Hashtable();
t.put(Context.PROVIDER_URL, "localhost:1099");
t.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
Context ctx = new InitialContext(t);
Queue q = (Queue) ctx.lookup("/queue/DLQ");
//----------------------------
ConnectionFactory cf = (ConnectionFactory) ctx.lookup("/ConnectionFactory");
Connection connection = cf.createConnection();
Session session = connection.createSession(true, 0);
//---------------------------------
MessageConsumer consumer = session.createConsumer(q);
connection.start();
SpyObjectMessage m;
Queue originialDestination = null;
//There can only be one in my case, but really you have to look it up every time.
MessageProducer producer = null;
while ((m = (SpyObjectMessage) consumer.receive(5000)) != null) {
Object o = m.getObject();
Date messageDate = new Date(m.getJMSTimestamp());
String originalQueue = m.getStringProperty("JBOSS_ORIG_DESTINATION");
if (originialDestination == null) {
originialDestination = (Queue) ctx.lookup("/queue/" +
originalQueue.substring(originalQueue.indexOf('.') + 1));
producer = session.createProducer(originialDestination);
}
producer.send(session.createObjectMessage((Serializable) o));
m.acknowledge();
}
//session.commit(); //Uncomment to make this real.
connection.close();
ctx.close();
다른 팁
살펴보십시오 헤르메스 JMS. JMS 대기열과 주제를 탐색하기위한 오픈 소스 도구입니다. 브로커의 배송 할 수없는 대기열에 끝나는 메시지를 재생할 수 있습니다.
참고 : Codestreet에서 일하고 있습니다
우리의 'JMS 용 ReplayService'제품은이 유스 케이스를 위해 정확히 구축되었습니다. 이전에 게시 된 메시지 검색 및 검색 (N-Times Delivery)-JMS는 실제로 1 회 전달을 위해 설계되었습니다.
JMS 용 ReplayService를 사용하면 주제 또는 대기열에 게시 된 모든 메시지를 녹음하기 위해 웹 로그 레코딩을 구성 할 수 있습니다. 그런 다음 웹 기반 GUI를 통해 개별 메시지 (Substring, Xpath 또는 JMS Selector)를 검색 한 다음 원래 JMS 대상으로 다시 재생할 수 있습니다.
보다 http://www.codestreet.com/marketdata/jms/jms_details.php 자세한 내용은.
제휴하지 않습니다 StackOverflow