No part of these notes may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior, written permission of Object Computing, Inc. (OCI) Micronaut + Groovy
2018, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 2 • MICRONAUT / GRAILS OCI TEA M • GUADALAJARA, SPAI N • CURATOR OF GROOVYCALAMARI.COM • GREACH Conference organize r • @SDELAM O • HTTPS://SERGIODELAMO.COM SERGIO DEL AMO
9 Groovy Specific Modules Dependency Description micronaut-inject-groovy Include AST transformations to generate bean definitions. Should be compileOnly on your classpath. micronaut-runtime-groovy Adds the ability to specify configuration placed in src/main/resources in Groovy format (i.e. application.groovy) micronaut-function-groovy Include AST transforms that make it easier to write Functions for AWS Lambda
30 GORM Modules Dependency Description micronaut-hibernate-gorm Configures GORM for Hibernate for Groovy applications micronaut-mongo-gorm Configures GORM for Mongo DB for Groovy applications micronaut-neo4j-gorm Configures GORM for Mongo DB for Groovy applications
36 Transaction demarcation ⚠ Each method that interacts with GORM should be annotated with GORM's grails.gorm.transactions.Transactional to ensure a session is present. You can also add the @Transactional annotation to the class.
• Configure Multitenancy Mod e • Configure Tenant Resolve r • Configure Domain classes which you want to be regarded as multi tenant. • User Tenants.* or Multi-tenancy Transformations.
2018, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 45 Multi-tenancy modes Modes Description DATABASE Separate database with a separate connection pool is used to store each tenants data. SCHEMA The same database, but different schemas are used to store each tenants’ data. DISCRIMINATOR The same database is used with a discriminator used to partition and isolate data.
2018, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 46 Multi-tenancy modes - Data isolation Modes Isolation DATABASE SCHEMA DISCRIMINATOR
2018, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 50 Multi-tenancy transformations Transformation Description @CurrentTenant Resolve the current tenant for the context of a class or method @Tenant Use a specifc tenant for the context of a class or method @WithoutTenant Execute logic without a specific tentnat (using the default connection)
52 Multi-Tenancy GORM - Tenant Resolvers Name Description Cookie Tenant Resolver Removes the current tenant from an HTTP cookie Fixed Tenant Resolver Resolves against a fixed tenant id HttpHeaderTenantResolver Resolves the current tenant from the request HTTP Header PrincipalTenantResolver Resolves the current tenant from the authenticated username SessionTenantResolver Resolves the current tenant from the HTTP Session SubdomainTenantResolver Resolves the tenant id from the subdomain SystemPropertyTenantResolver Resolves the tenant id from a system property