mirror of https://github.com/usbharu/Hideout.git
				
				
				
			feat: 起動前にRepositoryのチェックをするように
This commit is contained in:
		
							parent
							
								
									f1f6166a78
								
							
						
					
					
						commit
						de4ad8ecfd
					
				|  | @ -0,0 +1,30 @@ | |||
| /* | ||||
|  * Copyright (C) 2024 usbharu | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  * | ||||
|  *      http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  * | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
| 
 | ||||
| package dev.usbharu.owl.broker.domain.exception | ||||
| 
 | ||||
| class InvalidRepositoryException : RuntimeException { | ||||
|     constructor() : super() | ||||
|     constructor(message: String?) : super(message) | ||||
|     constructor(message: String?, cause: Throwable?) : super(message, cause) | ||||
|     constructor(cause: Throwable?) : super(cause) | ||||
|     constructor(message: String?, cause: Throwable?, enableSuppression: Boolean, writableStackTrace: Boolean) : super( | ||||
|         message, | ||||
|         cause, | ||||
|         enableSuppression, | ||||
|         writableStackTrace | ||||
|     ) | ||||
| } | ||||
|  | @ -17,6 +17,8 @@ | |||
| package dev.usbharu.owl.producer.embedded | ||||
| 
 | ||||
| import dev.usbharu.owl.broker.OwlBrokerApplication | ||||
| import dev.usbharu.owl.broker.domain.exception.InvalidRepositoryException | ||||
| import dev.usbharu.owl.broker.domain.model.producer.ProducerRepository | ||||
| import dev.usbharu.owl.broker.service.* | ||||
| import dev.usbharu.owl.common.retry.RetryPolicyFactory | ||||
| import dev.usbharu.owl.common.task.PublishedTask | ||||
|  | @ -53,6 +55,9 @@ class EmbeddedOwlProducer( | |||
|             modules(module, defaultModule, embeddedOwlProducerConfig.moduleContext.module()) | ||||
|         }.koin | ||||
| 
 | ||||
|         application.getOrNull<ProducerRepository>() | ||||
|             ?: throw InvalidRepositoryException("Repository not found. Install owl-broker-mongodb, etc. on the classpath") | ||||
| 
 | ||||
|         val producerService = application.get<ProducerService>() | ||||
| 
 | ||||
|         producerId = producerService.registerProducer( | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue