-
Notifications
You must be signed in to change notification settings - Fork 0
DelayedQueue for Scala (sub-project) #17
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
Merged
Conversation
This file contains hidden or 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
* Initial plan * Add Scala data structures for DelayedQueue - Created all configuration types (RetryConfig, JdbcDatabasePoolConfig, DelayedQueueTimeConfig, JdbcConnectionConfig, DelayedQueueJDBCConfig) - Created message and envelope types (ScheduledMessage, BatchedMessage, BatchedReply, AckEnvelope, MessageId, DeliveryType) - Created cron/scheduling types (CronMessage, CronConfigHash, CronDailySchedule, CronMessageGenerator) - Created return/outcome types (OfferOutcome, ResourceUnavailableException, JdbcDriver) - Added asJava and asScala conversion extensions for all types - All code compiles and is formatted Co-authored-by: alexandru <11753+alexandru@users.noreply.github.com> * Add tests for Scala data structures - Created test suites for RetryConfig, ScheduledMessage, JdbcDriver, and Cron types - All tests verify conversions (asJava/asScala), validation, and basic functionality - All 23 tests pass Co-authored-by: alexandru <11753+alexandru@users.noreply.github.com> * Address PR feedback: use Scala types, opaque MessageId, fix implementations - Replace java.time.Duration with scala.concurrent.duration.FiniteDuration - Make MessageId an opaque type instead of case class - Fix OfferOutcome pattern matching to use instanceof checks - Add covariance (+In, +A) to BatchedMessage and BatchedReply - Port CronConfigHash, CronDailySchedule implementations exactly from JVM - Add ScalaCheck and munit-scalacheck dependencies for property-based testing - Remove unused imports Co-authored-by: alexandru <11753+alexandru@users.noreply.github.com> * Add property-based testing with ScalaCheck - Add comprehensive property-based tests for all data structures - Test roundtrip conversions (asJava/asScala) - Test covariance for BatchedMessage and BatchedReply - Test validation for RetryConfig and CronDailySchedule - Test CronMessage key uniqueness - All 35 tests pass (23 unit + 12 property-based) Co-authored-by: alexandru <11753+alexandru@users.noreply.github.com> * Refactor: delegate implementations to JVM, use idiomatic Scala patterns Major changes per review feedback: - DeliveryType enum: Use Scala naming (FirstDelivery, Redelivery) - CronConfigHash: Changed to opaque type, delegate to JVM implementations - All factory methods delegate to JVM (fromDailyCron, fromPeriodicTick, fromString) - CronDailySchedule.getNextTimes delegates to JVM - CronMessage.key and staticPayload delegate to JVM - DelayedQueueTimeConfig defaults use JVM constants - JdbcConnectionConfig: username/password now Option - JdbcDatabasePoolConfig: Removed default parameters, added DEFAULT value - JdbcDriver: Private constructor, use JVM as source of truth with jvmEntries map - Test generators moved to common Generators.scala file - Removed fromClassName test as requested - All 34 tests pass Co-authored-by: alexandru <11753+alexandru@users.noreply.github.com> * Remove default parameters and delegate to JVM defaults - DelayedQueueJDBCConfig: Removed default parameters for ackEnvSource and retryPolicy - RetryConfig: Removed all default parameters (backoffFactor, maxRetries, totalSoftTimeout, perTryHardTimeout) - RetryConfig.DEFAULT and NO_RETRIES now delegate to JVM constants via asScala - Updated tests to provide all required parameters - All 34 tests pass Co-authored-by: alexandru <11753+alexandru@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: alexandru <11753+alexandru@users.noreply.github.com>
* Initial plan * Implement DelayedQueueInMemory Scala wrapper with tests - Created DelayedQueueInMemory.scala wrapping JVM implementation - Implemented all DelayedQueue trait methods with proper type conversions - Added CronService wrapper for cron functionality - Created comprehensive test suite (19 tests, all passing) - Follows existing patterns (asScala/asJava conversions) - Uses Cats Effect IO for side effects management Co-authored-by: alexandru <11753+alexandru@users.noreply.github.com> * Change to F[_] * Fix API again * Reformatting * Remove junk * Add concurrency test --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: alexandru <11753+alexandru@users.noreply.github.com> Co-authored-by: Alexandru Nedelcu <noreply@alexn.org>
) * Initial plan * Add DelayedQueueJDBC Scala wrapper and tests Co-authored-by: alexandru <11753+alexandru@users.noreply.github.com> * Fix compilation and test issues, format code - Added missing imports (cats.syntax.functor.*) - Fixed runMigrations signature (doesn't need serializer) - Added JDBC driver test dependencies to build.sbt - Fixed test isolation by using unique table names - Fixed database configuration for H2 and HSQLDB - Formatted code with scalafmt - All H2 and HSQLDB tests passing (36/36) Co-authored-by: alexandru <11753+alexandru@users.noreply.github.com> * Refactor to use PayloadCodec type-class and shared wrappers - Renamed MessageSerializer to PayloadCodec as a proper type-class - Changed deserialize to return Either[IllegalArgumentException, A] - Made forStrings a given instance based on JVM MessageSerializer.forStrings - Extracted shared DelayedQueueWrapper and CronServiceWrapper to internal.scala - Updated DelayedQueueJDBC to use implicit PayloadCodec parameter - Use Resource.fromAutoCloseable instead of Resource.make - Inject JavaClock like in DelayedQueueInMemory using Dispatcher - Use IO.interruptible for runMigrations - Added concurrency test (reduced to 100 messages for JDBC performance) - All 38 H2 and HSQLDB tests passing Co-authored-by: alexandru <11753+alexandru@users.noreply.github.com> * Fix compilation warnings and refactor internal wrappers - Moved wrappers from object internal to top-level private[scala] classes - Renamed getTypeName to typeName (remove Java-ism) - Removed all unused imports in DelayedQueueInMemory and DelayedQueueJDBC - All compilation warnings fixed - All 38 H2/HSQLDB tests passing Co-authored-by: alexandru <11753+alexandru@users.noreply.github.com> * Fix compilation errors * Remove SQLite --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: alexandru <11753+alexandru@users.noreply.github.com> Co-authored-by: Alexandru Nedelcu <noreply@alexn.org>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The plan is to wrap DelayedQueue JVM in a Scala-friendly API powered by Cats-Effect and functional programming.