james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benoit Tellier (Jira)" <server-...@james.apache.org>
Subject [jira] [Commented] (JAMES-3580) Can't integrate PostgreSQL completely
Date Tue, 11 May 2021 01:57:00 GMT

    [ https://issues.apache.org/jira/browse/JAMES-3580?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17342243#comment-17342243
] 

Benoit Tellier commented on JAMES-3580:
---------------------------------------

Hello Cosimo Damiano Prete,

This behaviour is expected. Unlike the Spring wiring, where a user could replace any sub-parts
of the running server with configuration only, and break things in very subtle ways, guice
setup is more strict: You cannot replace server running parts but only provide some well define
sets of extensions (mailet, matcher, protocol handler, mailbox listener, webadmin route).

So it is expected that you cannot change that.

However, James + Guice is more than just servers on the shelf. One can very easily assemble
a mail server of his own in just 10-100 lines of code by combining the Guice modules the way
he wants! Thus using James as a toolkit to craft your own tailor-made server. The fact that
the user needs to write code and its own assembling is expected as it is intended to clearly
state "your code, your responsibility" which means: 1. test your own components 2. test your
combinations.

I did a similar tailor made James server for my company: https://github.com/linagora/tmail-backend/

Especially the module declaration can be seen here: https://github.com/linagora/tmail-backend/blob/master/tmail-backend/apps/memory/src/main/java/com/linagora/tmail/james/app/MemoryServer.java

I guess we should at the very least write a *"how to"* on the topic, including a *code example*,
it would make the overall experience easier for end users. This how to would:
 - state how to override any component
 - state how to remove components

Would it fit your needs?

Benoit

> Can't integrate PostgreSQL completely
> -------------------------------------
>
>                 Key: JAMES-3580
>                 URL: https://issues.apache.org/jira/browse/JAMES-3580
>             Project: James Server
>          Issue Type: Bug
>          Components: guice, jpa
>    Affects Versions: 3.6.0
>            Reporter: Cosimo Damiano Prete
>            Priority: Blocker
>
> Hi guys.
> I'm migrating from James 2 to 3.6.0 and I cannot find any way to make it work completely
with PostgreSQL.
> By following the documentation, I set the DB connection properties in the james-database.properties
file but, somehow, in the logs I always get: 15:35:33.924 [INFO ] o.a.j.m.m.MemoryMailRepositoryStore
- JamesMailStore init... org.apache.james.mailrepository.memory.MemoryMailRepositoryStore@33827b88
> As a result, I don't see any data in the database at all. Unfortunately the documentation
doesn't really help much more, so I don't know where else I should have a look at.
> Moreover, in James 2 I had the possibility to specify my own datasource implementation.
Is it possible with James 3 as well and, if it's so, how?
> Finally, I would need to create the users on the fly if they don't exist. Is there something
already available? I was trying by using an extension which defines a Guice module providing
an interceptor: 
> {code:java}
> public class CreateUserIfMissingModule extends AbstractModule {
>     @Override
>     protected void configure() {
>         final CreateUserIfMissingInterceptor interceptor = new CreateUserIfMissingInterceptor();
>         requestInjection(interceptor); // Inject the repository
>         bindInterceptor(subclassesOf(UsersRepository.class), returns(subclassesOf(Boolean.class)),
interceptor);
>     }
> } {code}
> but, also this one, is not picked up at all.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message