feat: Producerのデフォルト実装を追加

This commit is contained in:
2024-03-31 12:12:20 +09:00
parent fad394bbab
commit 1c576f9463
15 changed files with 222 additions and 125 deletions
@@ -18,6 +18,12 @@ package dev.usbharu.owl.common.task
import dev.usbharu.owl.common.property.PropertyType
class PropertyDefinition(val map: Map<String, PropertyType>) : Map<String, PropertyType> by map{
class PropertyDefinition(val map: Map<String, PropertyType>) : Map<String, PropertyType> by map {
fun hash(): Long {
var hash = 1L
map.map { it.key + it.value.name }.joinToString("").map { hash *= it.code * 31 }
return hash
}
}
@@ -17,15 +17,15 @@
package dev.usbharu.owl.common.task
import dev.usbharu.owl.common.property.PropertyValue
import dev.usbharu.owl.common.retry.RetryPolicy
interface TaskDefinition<T : Task> {
val name: String
val priority: Int
val maxRetry: Int
val retryPolicy:RetryPolicy
val retryPolicy: String
val timeoutMilli: Long
val propertyDefinition: PropertyDefinition
val type: Class<T>
fun serialize(task: T): Map<String, PropertyValue<*>>
fun deserialize(value: Map<String, PropertyValue<*>>): T