Skip to content

Instantly share code, notes, and snippets.

@thomasdarimont
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasdarimont/6a0bc7742808d8e96c09 to your computer and use it in GitHub Desktop.
Save thomasdarimont/6a0bc7742808d8e96c09 to your computer and use it in GitHub Desktop.
replay: A prototypic XD source module definition that is able to replay pre-recorded events from a file. Allows to configure a fixed delay in milliseconds or an SpEL expression that the module waits for issuing a new event.
options_class = org.springframework.xd.dirt.modules.metadata.ReplaySourceOptionsMetadata
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-file="http://www.springframework.org/schema/integration/file"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration
http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/file
http://www.springframework.org/schema/integration/file/spring-integration-file.xsd
">
<int-file:tail-inbound-channel-adapter channel="delayChannel" file="${file}" end="false"/>
<int:delayer id="rateLimitDelayer" input-channel="delayChannel" default-delay="${delay}" expression="${delayExpression:}" output-channel="output"/>
<int:channel id="output"/>
</beans>
/*
* Copyright 2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.xd.dirt.modules.metadata;
import org.springframework.xd.module.options.spi.ModuleOption;
/**
* Describes options to the {@code replay} source module.
*
* @author Thomas Darimont
*/
public class ReplaySourceOptionsMetadata {
private String delayExpression;
private int delay;
private String file;
public String getDelayExpression() {
return delayExpression;
}
@ModuleOption(value = "the delay expression")
public void setDelayExpression(String delayExpression) {
this.delayExpression = delayExpression;
}
public String getFile() {
return file;
}
@ModuleOption(value = "the file location to replay the events from")
public void setFile(String file) {
this.file = file;
}
public int getDelay() {
return delay;
}
@ModuleOption(value = "the fixed delay in milli seconds")
public void setDelay(int delay) {
this.delay = delay;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment