に対してのOracleDataSourceは堅牢にだから私は、ConnectionFactoryを扱う高度なキューを得た:は、データベースの再起動とhickups
ConnectionFactory jmsQueueConnectionFactory() throws JMSException, SQLException {
final OracleDataSource dataSource = new OracleDataSource();
dataSource.setUser(username);
dataSource.setPassword(password);
dataSource.setURL(url);
dataSource.setImplicitCachingEnabled(true);
dataSource.setFastConnectionFailoverEnabled(true);
return AQjmsFactory.getConnectionFactory(dataSource);
}
これは、再起動または時々ネットワークはわずかhickupを持っている可能性があります共有データベース上で実行されています。その結果、キューからのメッセージはなくなります。
私はメッセージを取得するために、スプリングのMessageListenerを使用して、キューがもはや実行されていないというインジケータまたはので、これまで何が実際にはありません。アプリケーションを再起動すると、すでに処理されていたはずの古いメッセージがロードされます。
方法または特定のデータソース実装再接続か何かはありますか?
更新:リスナーのImpl
@Bean
OracleAqQueueFactoryBean etlQueueFactory() throws JMSException, SQLException {
final OracleAqQueueFactoryBean bean = new OracleAqQueueFactoryBean();
bean.setConnectionFactory(jmsQueueConnectionFactory());
bean.setOracleQueueUser("USER");
bean.setOracleQueueName("QUEUE");
return bean;
}
@Bean
DefaultMessageListenerContainer jmsContainer() throws JMSException, SQLException {
final DefaultMessageListenerContainer bean = new DefaultMessageListenerContainer();
bean.setConnectionFactory(jmsQueueConnectionFactory());
bean.setDestination(etlQueueFactory().getObject());
bean.setMessageListener(new MyListener());
bean.setSessionTransacted(false);
return bean;
}
public class MyListener implements MessageListener {
@Override
public void onMessage(Message message) {
...
}
}
答えてくれてありがとう。残りの設定で質問を更新しました。私はDefaultMessageListenerContainerを使用して、MessageListenerを実装するClassを取得します。 DBの再起動後、onMessageはもうアクティブではないようです。 –