7 changed files with 39 additions and 44 deletions
@ -0,0 +1 @@ |
|||||
|
target |
||||
@ -0,0 +1,18 @@ |
|||||
|
package org.sebi.incident; |
||||
|
|
||||
|
import org.eclipse.microprofile.rest.client.annotation.RegisterProvider; |
||||
|
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; |
||||
|
import org.jboss.resteasy.annotations.jaxrs.QueryParam; |
||||
|
|
||||
|
import javax.ws.rs.GET; |
||||
|
import javax.ws.rs.Path; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Path("/rest/incidents") |
||||
|
@RegisterRestClient(configKey = "incident-service") |
||||
|
public interface IncidentService { |
||||
|
|
||||
|
@GET |
||||
|
List<Incident> getIncidents(@QueryParam("api_key") String apikey); |
||||
|
} |
||||
@ -1,29 +0,0 @@ |
|||||
package org.sebi.incident; |
|
||||
|
|
||||
import java.util.Date; |
|
||||
|
|
||||
import javax.enterprise.context.ApplicationScoped; |
|
||||
import javax.enterprise.event.Observes; |
|
||||
import javax.transaction.Transactional; |
|
||||
|
|
||||
import io.quarkus.runtime.StartupEvent; |
|
||||
|
|
||||
@ApplicationScoped |
|
||||
public class IncidentStartup { |
|
||||
|
|
||||
@Transactional |
|
||||
void onStart(@Observes StartupEvent ev) { |
|
||||
Incident incident = new Incident(); |
|
||||
incident.date = new Date(); |
|
||||
incident.description = "coupure fibre"; |
|
||||
incident.status = false; |
|
||||
incident.persist(); |
|
||||
|
|
||||
Incident incident1 = new Incident(); |
|
||||
incident1.date = new Date(); |
|
||||
incident1.description = "Panne émetteur"; |
|
||||
incident1.status = true; |
|
||||
incident1.persist(); |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
@ -1,4 +1,3 @@ |
|||||
quarkus.datasource.jdbc.url=jdbc:h2:mem:myDB |
%dev.quarkus.rest-client.incident-service.url=http://localhost:8081 |
||||
quarkus.datasource.jdbc.min-size=3 |
quarkus.rest-client.incident-service.scope=javax.inject.Singleton |
||||
quarkus.datasource.jdbc.max-size=13 |
%dev.apikey=mysecret |
||||
quarkus.hibernate-orm.database.generation=update |
|
||||
|
|||||
Loading…
Reference in new issue