I am having issues adding new REST route following...
# random
d
I am having issues adding new REST route following the
SavepointTriggerHandlers
skeleton. Unit tests using the
TestingRestfulGateway
work fine but I keep on hitting the
UnsupportedOperationException
from
RestfulGateway
for the new added method when using the REST api. I did implement the new method but hitting this exception makes me think it is not in the proper class. Can anyone give me some insights on the effectively used gateway when performing api calls? thanks! (More details in the comments)
βœ… 1
1. I started copying the skeleton of `SavepointTriggerHandlers`with my own logic along with the related classes: Info, StatusHeaders, StatusMessageParameters, TriggerHeaders, TriggerMessageParameters, TRiggerRequestBody)
2. I initialized the Handlers in the `WebMonitorEndpoint`and added them to the list of handlers (works fine)
3. Implemented the logic in SchedulerBase just like the `triggerSavepoint`method.
c
can you show me the stack trace containing the
UnsupportedOperationException
?
Which
RestfulGateway
implementations did you modify to implement the added method?
d
stack trace.cpp
FYI I am testing a functionality similar to the Rescaling operation that has been deprecated
c
Doesn't look like like
RestfulGateway.triggerRescheduling
is actually implemented; did you just add it to the interface with a default implementation that throws an
UnsupportedOperationException
, and didn't touch any class implementing the interface?
d
Yep just like it is for `triggerSavepoint`or
triggerCheckpoint
I did touch SchedulerBase which is used by
JobMaster
c
Difference is these methods are overridden in the Dispatcher, actually implementing the required logic.
d
Not gonna lie, without documentation I found it hard to know which class implements which only with IntelIJ
I think I did add the logic in the Dispatcher as well, gonna make a quic,k check
c
use View -> Tool Windows -> Hiearchy on the RestfulGateway to get existing subclasses.
πŸ‘ 1
d
I found out that the signature differs in the Dispatcher
Should be the reason why it uses the default in RestfulGateway
I'll try and fix this and keep you in touch, thanks already for your time !! πŸ™‚
c
It's a good idea to add
@Override
annotations to catch such mistakes early.
d
Indeed...
Think I found the issue, I added another default method in the DispatcherGateway with a slight difference (JobID instead of AsynchronousJobOperationKey). Should be the issue
Can confirm, it is working fine. Thanks a lot!