Skip to content
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

Database.from(<DataSource>) has been removed #4

Closed
flyaruu opened this issue Sep 27, 2017 · 9 comments
Closed

Database.from(<DataSource>) has been removed #4

flyaruu opened this issue Sep 27, 2017 · 9 comments

Comments

@flyaruu
Copy link

flyaruu commented Sep 27, 2017

I'm using rxjava-jdbc and I use Database.from() pretty much everywhere. I'm upgrading to RxJava2 and see that that is no longer possible.

Is this intentional? Is there a straightforward work around?

@davidmoten
Copy link
Owner

davidmoten commented Sep 27, 2017 via email

@flyaruu
Copy link
Author

flyaruu commented Sep 27, 2017

Ok, I know create a 'ConnectionProviderFromDataSource' (basically copied from the rxjava1 jdbc impl) that wraps the DataSource, use that when creating a Pool, and pass that when querying a datasource.

Seems to work fine, thanks!

@flyaruu flyaruu closed this as completed Sep 27, 2017
@davidmoten
Copy link
Owner

davidmoten commented Sep 27, 2017 via email

@davidmoten
Copy link
Owner

I'll reopen this while I'm working on it. I'll need for starters to do some unit testing with a blocking ConnectionProvider (and make them easy to create from a DataSource for instance).

@davidmoten davidmoten reopened this Sep 27, 2017
davidmoten added a commit that referenced this issue Sep 27, 2017
davidmoten added a commit that referenced this issue Sep 28, 2017
@davidmoten
Copy link
Owner

@flyaruu Out of curiosity do you deploy your application to a container so that the DataSource is shared with other applications or is it standalone?

I've added a method Database.fromBlocking(DataSource) to source and it is passing one unit test. I'll add more unit tests over the next couple of days and make a release.

I'll be discussing these options in the README shortly:

  • use a NonBlockingPool to reserve a portion or all of the DataSource connections
  • use a Blocking connection provider to share connections as normal with other DataSource users (this is the behaviour that rxjava-jdbc uses)

@flyaruu
Copy link
Author

flyaruu commented Sep 29, 2017

Right now they are mixed. I'm rewriting part of a legacy application to use a reactive model, perhaps I'll do all of it at some point, but realistically I think it will coexist with blocking calls.

@davidmoten
Copy link
Owner

davidmoten commented Sep 30, 2017

0.1-RC8 has been released with support for blocking connection providers (like a shared DataSource).

Database.fromBlocking(DataSource)

0.1-RC9 will have an overload in the Pools.nonBlocking() builder for specifying a .connectionProvider(DataSource).

I'll release 0.1-RC9 in a day or two.

@flyaruu
Copy link
Author

flyaruu commented Sep 30, 2017

Sounds great! I'll have a look at it, thanks!

@flyaruu
Copy link
Author

flyaruu commented Oct 4, 2017

Works like a charm!

@flyaruu flyaruu closed this as completed Oct 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants