File tree Expand file tree Collapse file tree 4 files changed +5
-19
lines changed
main/java/br/com/grupo63/serviceproduction
test/java/br/com/grupo63/serviceproduction Expand file tree Collapse file tree 4 files changed +5
-19
lines changed Original file line number Diff line number Diff line change 6
6
import br .com .grupo63 .techchallenge .common .api .controller .AbstractAPIController ;
7
7
import br .com .grupo63 .techchallenge .common .exception .NotFoundException ;
8
8
import br .com .grupo63 .techchallenge .common .exception .ValidationException ;
9
- import io .awspring .cloud .sqs .operations .SqsTemplate ;
10
9
import io .swagger .v3 .oas .annotations .Operation ;
11
10
import io .swagger .v3 .oas .annotations .Parameter ;
12
11
import io .swagger .v3 .oas .annotations .tags .Tag ;
23
22
public class StatusAPIController extends AbstractAPIController {
24
23
25
24
private final StatusController controller ;
26
- private final SqsTemplate sqsTemplate ;
27
-
28
- @ GetMapping ("/batata" )
29
- public void batata () {
30
- sqsTemplate .send (sqsSendOptions ->
31
- sqsSendOptions
32
- .queue ("approvedPayments.fifo" )
33
- .payload (12 ));
34
- }
35
25
36
26
@ Operation (
37
27
tags = "5ª chamada - Fluxo principal - Acompanhamento e entrega" ,
Original file line number Diff line number Diff line change 1
1
package br .com .grupo63 .serviceproduction .api .controller .status ;
2
2
3
3
import br .com .grupo63 .serviceproduction .controller .StatusController ;
4
+ import br .com .grupo63 .techchallenge .common .exception .NotFoundException ;
5
+ import br .com .grupo63 .techchallenge .common .exception .ValidationException ;
4
6
import com .amazonaws .services .sqs .model .Message ;
5
7
import io .awspring .cloud .sqs .annotation .SqsListener ;
6
8
import lombok .RequiredArgsConstructor ;
@@ -15,7 +17,7 @@ public class StatusQueueController {
15
17
private final StatusController controller ;
16
18
17
19
@ SqsListener (value = "approvedPayments.fifo" )
18
- public void processMessage (int message ) {
19
- System . err . println ( message );
20
+ public void processMessage (int orderId ) throws ValidationException , NotFoundException {
21
+ controller . advanceStatus ( orderId );
20
22
}
21
23
}
Original file line number Diff line number Diff line change 1
1
package br .com .grupo63 .serviceproduction .config ;
2
2
3
- import io .awspring .cloud .sqs .operations .SqsTemplate ;
4
3
import org .springframework .beans .factory .annotation .Value ;
5
4
import org .springframework .context .annotation .Bean ;
6
5
import org .springframework .context .annotation .Configuration ;
@@ -30,9 +29,4 @@ SqsAsyncClient sqsAsyncClient(){
30
29
.create (AwsBasicCredentials .create (accessKey , secretKey )))
31
30
.build ();
32
31
}
33
-
34
- @ Bean
35
- public SqsTemplate sqsTemplate (SqsAsyncClient sqsAsyncClient ){
36
- return SqsTemplate .builder ().sqsAsyncClient (sqsAsyncClient ).build ();
37
- }
38
32
}
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ public void setUp() {
45
45
MockitoAnnotations .openMocks (this );
46
46
statusUseCase = new StatusUseCase (statusJpaAdapter );
47
47
statusController = new StatusController (statusUseCase );
48
- statusAPIController = new StatusAPIController (statusController , null );
48
+ statusAPIController = new StatusAPIController (statusController );
49
49
}
50
50
51
51
@ SneakyThrows
You can’t perform that action at this time.
0 commit comments