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#81 from cw68ster/base-line
add batch stream features and cycle schedule
- Loading branch information
Showing
85 changed files
with
5,418 additions
and
116 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
58 changes: 58 additions & 0 deletions
58
rocketmq-streams-channel-db/src/main/java/org/apache/rocketmq/streams/db/CycleSplit.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,58 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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.apache.rocketmq.streams.db; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* @description | ||
*/ | ||
public class CycleSplit extends DynamicMultipleDBSplit implements Serializable { | ||
|
||
private static final long serialVersionUID = 4309494143340650195L; | ||
String cyclePeriod; | ||
|
||
public CycleSplit(){ | ||
|
||
} | ||
|
||
public CycleSplit(String version){ | ||
this.cyclePeriod = version; | ||
} | ||
|
||
@Override | ||
public String getQueueId() { | ||
return String.join("_", logicTableName, suffix, cyclePeriod); | ||
} | ||
|
||
public String getCyclePeriod() { | ||
return cyclePeriod; | ||
} | ||
|
||
public void setCyclePeriod(String cyclePeriod) { | ||
this.cyclePeriod = cyclePeriod; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "CycleSplit{" + | ||
"cyclePeriod='" + cyclePeriod + '\'' + | ||
", suffix='" + suffix + '\'' + | ||
", logicTableName='" + logicTableName + '\'' + | ||
'}'; | ||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
...reams-channel-db/src/main/java/org/apache/rocketmq/streams/db/DynamicMultipleDBSplit.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,81 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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.apache.rocketmq.streams.db; | ||
|
||
import org.apache.rocketmq.streams.common.channel.split.ISplit; | ||
import org.apache.rocketmq.streams.common.configurable.BasedConfigurable; | ||
|
||
/** | ||
* @description | ||
*/ | ||
public class DynamicMultipleDBSplit extends BasedConfigurable implements ISplit<DynamicMultipleDBSplit, String> { | ||
|
||
String suffix; | ||
String logicTableName; | ||
|
||
public DynamicMultipleDBSplit() { | ||
} | ||
|
||
public DynamicMultipleDBSplit(String suffix, String logicTableName) { | ||
this.suffix = suffix; | ||
this.logicTableName = logicTableName; | ||
} | ||
|
||
public String getSuffix() { | ||
return suffix; | ||
} | ||
|
||
public void setSuffix(String suffix) { | ||
this.suffix = suffix; | ||
} | ||
|
||
public String getLogicTableName() { | ||
return logicTableName; | ||
} | ||
|
||
public void setLogicTableName(String logicTableName) { | ||
this.logicTableName = logicTableName; | ||
} | ||
|
||
@Override | ||
public String getQueueId() { | ||
return logicTableName + "_" + suffix; | ||
} | ||
|
||
@Override | ||
public String getPlusQueueId() { | ||
throw new RuntimeException("unsupported getPlusQueueId!"); | ||
} | ||
|
||
@Override | ||
public String getQueue() { | ||
return logicTableName + "_" + suffix; | ||
} | ||
|
||
@Override | ||
public int compareTo(DynamicMultipleDBSplit o) { | ||
return getQueue().compareTo(o.getQueue()); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "DynamicMultipleDBSplit{" + | ||
"logicTableName='" + logicTableName + '\'' + | ||
", suffix='" + suffix + '\'' + | ||
'}'; | ||
} | ||
} |
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
Oops, something went wrong.