Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/main/java/org/apache/storm/jms/spout/JmsSpout.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ public void open(Map conf, TopologyContext context,
if(this.tupleProducer == null){
throw new IllegalStateException("JMS Tuple Producer has not been set.");
}
Integer topologyTimeout = (Integer)conf.get("topology.message.timeout.secs");
Long topologyTimeout = (Long)conf.get("topology.message.timeout.secs");
// TODO fine a way to get the default timeout from storm, so we're not hard-coding to 30 seconds (it could change)
topologyTimeout = topologyTimeout == null ? 30 : topologyTimeout;
if( (topologyTimeout.intValue() * 1000 )> this.recoveryPeriod){
topologyTimeout = topologyTimeout == null ? new Long(30L) : topologyTimeout;
if( (topologyTimeout.intValue() * 1000) > this.recoveryPeriod){
LOG.warn("*** WARNING *** : " +
"Recovery period ("+ this.recoveryPeriod + " ms.) is less then the configured " +
"'topology.message.timeout.secs' of " + topologyTimeout +
Expand Down
6 changes: 5 additions & 1 deletion src/test/java/org/apache/storm/jms/spout/JmsSpoutTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ public void testFailure() throws JMSException, Exception{
spout.setJmsTupleProducer(new MockTupleProducer());
spout.setJmsAcknowledgeMode(Session.CLIENT_ACKNOWLEDGE);
spout.setRecoveryPeriod(10); // Rapid recovery for testing.
spout.open(new HashMap<String,String>(), null, collector);

HashMap<String,Object> conf = new HashMap<String,Object>();
conf.put("topology.message.timeout.secs", new Long(10L));
spout.open(conf, null, collector);

Message msg = this.sendMessage(mockProvider.connectionFactory(), mockProvider.destination());
Thread.sleep(100);
spout.nextTuple(); // Pretend to be storm.
Expand Down