| | |
| | | import com.battery.device.bts.BtsDeviceAdapterFactory; |
| | | import com.battery.device.api.registry.DeviceAdapterRegistry; |
| | | import com.battery.device.neware.NewareMysqlAdapterFactory; |
| | | import com.battery.business.mapper.TDeviceIngestRecordMapper; |
| | | import com.battery.business.service.impl.PushIngestAdapterFactory; |
| | | |
| | | /** |
| | | * 装配单进程设备适配器运行时。 |
| | |
| | | * <p>注册表按存储形态持有全部可用实现;实例按 {@code t_device_adapter} 配置或代码装配注册。 |
| | | * 同一进程内可并存多个来源实例,取数按通道身份里的适配器编码解析到各自实例。 |
| | | * 某个类型是否真的有实例可用只由配置决定,因此这里不再按 profile 收窄可注册的类型。 |
| | | * |
| | | * <p>推式来源({@code PUSH_INGEST})读的是本项目的落地表,所以它的工厂拿业务 Mapper 而不是厂商连接。 |
| | | */ |
| | | @Configuration |
| | | @EnableScheduling |
| | | public class DeviceAdapterRuntimeConfig |
| | | { |
| | | @Bean(destroyMethod = "close") |
| | | public DeviceAdapterRegistry deviceAdapterRegistry() |
| | | public DeviceAdapterRegistry deviceAdapterRegistry(TDeviceIngestRecordMapper ingestRecords) |
| | | { |
| | | return new DeviceAdapterRegistry(List.of(new NoopDeviceAdapterFactory(), new BtsDeviceAdapterFactory(), |
| | | new NewareMysqlAdapterFactory())); |
| | | new NewareMysqlAdapterFactory(), new PushIngestAdapterFactory(ingestRecords))); |
| | | } |
| | | } |