forked from apache/rocketmq-streams
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request apache#49 from yuanxiaodong/window
add cache filter to excute quickly for script
- Loading branch information
Showing
63 changed files
with
1,440 additions
and
471 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...eams-clients/src/test/java/org/apache/rocketmq/streams/client/ScriptOptimizationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.apache.rocketmq.streams.client; | ||
|
||
import org.apache.rocketmq.streams.common.utils.FileUtil; | ||
import org.apache.rocketmq.streams.script.operator.impl.FunctionScript; | ||
import org.junit.Test; | ||
|
||
public class ScriptOptimizationTest { | ||
|
||
@Test | ||
public void testScriptOptimization(){ | ||
String scriptValue= FileUtil.loadFileContent("/Users/yuanxiaodong/Downloads/script.txt"); | ||
FunctionScript functionScript=new FunctionScript(scriptValue); | ||
functionScript.init(); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...n/java/org/apache/rocketmq/streams/common/channel/impl/transit/TransitChannelBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package org.apache.rocketmq.streams.common.channel.impl.transit; | ||
|
||
import com.alibaba.fastjson.JSONObject; | ||
import com.google.auto.service.AutoService; | ||
import java.util.Properties; | ||
import org.apache.rocketmq.streams.common.channel.builder.IChannelBuilder; | ||
import org.apache.rocketmq.streams.common.channel.impl.memory.MemorySource; | ||
import org.apache.rocketmq.streams.common.channel.sink.ISink; | ||
import org.apache.rocketmq.streams.common.channel.source.ISource; | ||
import org.apache.rocketmq.streams.common.metadata.MetaData; | ||
import org.apache.rocketmq.streams.common.model.ServiceName; | ||
import org.apache.rocketmq.streams.common.utils.ConfigurableUtil; | ||
|
||
@AutoService(IChannelBuilder.class) | ||
@ServiceName(value = TransitChannelBuilder.TYPE, aliasName = "cache_table") | ||
public class TransitChannelBuilder implements IChannelBuilder { | ||
public static final String TYPE = "transit"; | ||
|
||
@Override public ISource createSource(String namespace, String name, Properties properties, MetaData metaData) { | ||
return (TransitSource)ConfigurableUtil.create(TransitSource.class.getName(), namespace, name, createFormatProperty(properties), null); | ||
} | ||
|
||
@Override public String getType() { | ||
return TYPE; | ||
} | ||
|
||
@Override public ISink createSink(String namespace, String name, Properties properties, MetaData metaData) { | ||
return (TransitSink)ConfigurableUtil.create(TransitSink.class.getName(), namespace, name, createFormatProperty(properties), null); | ||
} | ||
|
||
|
||
/** | ||
* 创建标准的属性文件 | ||
* | ||
* @param properties | ||
* @return | ||
*/ | ||
protected JSONObject createFormatProperty(Properties properties) { | ||
JSONObject formatProperties = new JSONObject(); | ||
for (Object object : properties.keySet()) { | ||
String key = (String)object; | ||
if ("type".equals(key)) { | ||
continue; | ||
} | ||
formatProperties.put(key, properties.getProperty(key)); | ||
} | ||
IChannelBuilder.formatPropertiesName(formatProperties, properties, "logFingerprintFieldNames", "filterFieldNames"); | ||
IChannelBuilder.formatPropertiesName(formatProperties, properties, "tableName", "sql_create_table_name"); | ||
// IChannelBuilder.formatPropertiesName(formatProperties, properties, "maxThread", "thread.max.count"); | ||
return formatProperties; | ||
} | ||
} |
Oops, something went wrong.