-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add basic workflow #3
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,29 @@ | ||
package io.xdb.core.process; | ||
|
||
import io.xdb.gen.models.ProcessIdReusePolicy; | ||
import static io.xdb.core.utils.ProcessUtil.DEFAULT_NAMESPACE; | ||
|
||
import com.google.common.base.Strings; | ||
import io.xdb.core.utils.ProcessUtil; | ||
import io.xdb.gen.models.ProcessStartConfig; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Builder | ||
@Getter | ||
public class ProcessOptions { | ||
|
||
// If not set, use the default value. | ||
private final String namespace; | ||
private final String type; | ||
private final ProcessIdReusePolicy processIdReusePolicy; | ||
private final Integer timeoutSeconds; | ||
private final ProcessStartConfig processStartConfig; | ||
|
||
public String getNamespace() { | ||
return Strings.isNullOrEmpty(namespace) ? DEFAULT_NAMESPACE : namespace; | ||
} | ||
|
||
public String getType(final Class<? extends Process> processClass) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It maybe better to move it to Process class as a package private method(, so that it doesn't require to pass in any parameter. ), or keep it in ProcessUtil Passing a process class here is a bit strange There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another idea: maybe it's even better to require passing in a Process instance when creating this ProcessOptions (is it possible in lombok to have a required field?, looks like by default all fields are optional in lombok --- looks like just put @NOT_NULL ?) In the Process interface: public interface Process{
default getProcessOptions(){
return ProcessOptions.build(this)
}
} And we can make this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In lombok builder, the default value of each field is NULL. Adding Use Lombok also provides another way to genetate the ProcessOptionsBuilder by There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
return Strings.isNullOrEmpty(type) ? ProcessUtil.getProcessType(processClass) : type; | ||
} | ||
|
||
public ProcessStartConfig getProcessStartConfig() { | ||
return processStartConfig; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package io.xdb.core.state; | ||
|
||
import com.google.common.base.Strings; | ||
import io.xdb.core.utils.ProcessUtil; | ||
import lombok.Builder; | ||
|
||
@Builder | ||
public class AsyncStateOptions { | ||
|
||
private final String id; | ||
|
||
public String getId(final Class<? extends AsyncState> stateClass) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. similar here, it seems better to pass in the state instance as required for builder? |
||
return Strings.isNullOrEmpty(id) ? ProcessUtil.getStateId(stateClass) : id; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use xdb public request as the input to BasicClient to reduce the SDK side wrapper.