내 Grails 애플리케이션에는 '조직'단위로 다른 텍스트를 사용자에게 표시 할 수 있지만 우선 적용하지 않는 경우 messages.properties에서 텍스트를 읽는 것으로 되돌아 가야한다는 요구 사항이 있습니다 텍스트는 조직에 대해 정의됩니다.Grails 비동기 메일 플러그인 DatabaseMessageSource로
http 요청의 범위에서 잘 작동하는 here과 유사한 접근 방식을 사용하고 있습니다. 그러나 이제는 조직별로 이메일 내용을 정의해야합니다. 이는 이메일이 약간 문제가됩니다. 비동기 적으로 전송됩니다 (비동기 메일 플러그인 사용). 나의 현재 resolveCode()
구현은 다음과 같습니다 : 나는 세션 범위 프록시를 사용하여 현재 '세션'조직을 해결하기 위해 필요로하는
public MessageFormat resolveCode(String code, Locale locale) {
Message msg = null
try {
Organisation currentOrganisation = currentOrganisationSessionProxy.currentSessionOrganisation
msg = Message.findByCodeAndLocaleAndOrganisation(code, locale, currentOrganisation)
} catch (Exception e) {
//handle exception
}
def format
if (msg) {
format = new MessageFormat(msg.text, msg.locale)
} else {
format = messageBundleMessageSource.resolveCode(code, locale)
}
return format
}
내가 약간 DatabaseMessageSource 구현을 수정했습니다.
누구나 현지화 된 조직 별 전자 메일을 비동기 적으로 보내는 좋은 방법을 제안 할 수 있습니까? 내 생각에 이메일과 함께 조직 ID를 유지 한 다음 일부 방법을 검색해야합니다. DatabaseMessageSource
. 어떤 도움을 주셔서 감사합니다.