Search in sources :

Example 11 with Ack

use of org.wso2.ei.dashboard.core.rest.model.Ack in project carbon-mediation by wso2.

the class HL7TransportSender method sendApplicationACKResponse.

/**
 * Send application ack message from the incoming response  to the client
 * @param messageContext
 * @param outTransportInfo
 * @throws AxisFault
 */
private void sendApplicationACKResponse(MessageContext messageContext, OutTransportInfo outTransportInfo) throws AxisFault {
    HL7ProcessingContext processingContext = ((HL7TransportOutInfo) outTransportInfo).getProcessingContext();
    try {
        Message message = xmlPayloadToHL7Message(messageContext);
        processingContext.offerApplicationResponses(message, messageContext);
    } catch (HL7Exception e) {
        handleException("Error while sending an custom ack message", e);
    }
}
Also used : Message(ca.uhn.hl7v2.model.Message) HL7ProcessingContext(org.wso2.carbon.business.messaging.hl7.common.HL7ProcessingContext) HL7Exception(ca.uhn.hl7v2.HL7Exception)

Example 12 with Ack

use of org.wso2.ei.dashboard.core.rest.model.Ack in project wso2-synapse by wso2.

the class VFSTransportSenderTest method testTransportSenderInitAndSend.

/**
 * Test Transport sender initialization and sending a file
 * @throws AxisFault
 */
public void testTransportSenderInitAndSend() throws AxisFault, XMLStreamException {
    // Clear file holder
    MockFileHolder.getInstance().clear();
    VFSTransportSender vfsTransportSender = new VFSTransportSender();
    ConfigurationContext configurationContext = new ConfigurationContext(new AxisConfiguration());
    TransportOutDescription transportOutDescription = new TransportOutDescription("Test");
    // Enable Autolock release
    transportOutDescription.addParameter(new Parameter(VFSConstants.TRANSPORT_AUTO_LOCK_RELEASE, true));
    // Set Autolock release interval with default value
    transportOutDescription.addParameter(new Parameter(VFSConstants.TRANSPORT_AUTO_LOCK_RELEASE_INTERVAL, 20000));
    transportOutDescription.addParameter(new Parameter(VFSConstants.TRANSPORT_AUTO_LOCK_RELEASE_SAME_NODE, true));
    vfsTransportSender.init(configurationContext, transportOutDescription);
    // Create message context
    org.apache.axis2.context.MessageContext mc = new org.apache.axis2.context.MessageContext();
    populateMessageContext(mc);
    String filePath = "test1:///foo/bar/test-" + System.currentTimeMillis() + ".ack";
    String parameters = "?transport.vfs.MaxRetryCount=0&transport.vfs.ReconnectTimeout=1&" + "transport.vfs.SendFileSynchronously=true&transport.vfs.CreateFolder=true";
    String fURI = filePath + parameters;
    OutTransportInfo outTransportInfo = new VFSOutTransportInfo(fURI, true);
    vfsTransportSender.sendMessage(mc, fURI, outTransportInfo);
    MockFileHolder fileHolder = MockFileHolder.getInstance();
    Assert.assertNotNull("File creation failed", fileHolder.getFile(filePath));
}
Also used : ConfigurationContext(org.apache.axis2.context.ConfigurationContext) AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) MockFileHolder(org.wso2.carbon.inbound.endpoint.protocol.file.MockFileHolder) VFSOutTransportInfo(org.apache.synapse.commons.vfs.VFSOutTransportInfo) OutTransportInfo(org.apache.axis2.transport.OutTransportInfo) Parameter(org.apache.axis2.description.Parameter) MessageContext(org.apache.axis2.context.MessageContext) MessageContext(org.apache.axis2.context.MessageContext) VFSOutTransportInfo(org.apache.synapse.commons.vfs.VFSOutTransportInfo) TransportOutDescription(org.apache.axis2.description.TransportOutDescription)

Example 13 with Ack

use of org.wso2.ei.dashboard.core.rest.model.Ack in project product-mi-tooling by wso2.

the class GroupsApi method addUser.

@POST
@Path("/{group-id}/users")
@Consumes({ "application/json" })
@Produces({ "application/json" })
@Operation(summary = "Add user", description = "", tags = { "Users" })
@ApiResponses(value = { @ApiResponse(responseCode = "200", description = "User insert status", content = @Content(schema = @Schema(implementation = SuccessStatus.class))), @ApiResponse(responseCode = "200", description = "Unexpected error", content = @Content(schema = @Schema(implementation = Error.class))) })
public Response addUser(@PathParam("group-id") @Parameter(description = "Group ID of the node") String groupId, @Valid AddUserRequest request) throws ManagementApiException {
    UsersDelegate usersDelegate = new UsersDelegate();
    Ack ack = usersDelegate.addUser(groupId, request);
    Response.ResponseBuilder responseBuilder = Response.ok().entity(ack);
    HttpUtils.setHeaders(responseBuilder);
    return responseBuilder.build();
}
Also used : Response(javax.ws.rs.core.Response) ApiResponse(io.swagger.v3.oas.annotations.responses.ApiResponse) UsersDelegate(org.wso2.ei.dashboard.micro.integrator.delegates.UsersDelegate) Ack(org.wso2.ei.dashboard.core.rest.model.Ack) Operation(io.swagger.v3.oas.annotations.Operation) ApiResponses(io.swagger.v3.oas.annotations.responses.ApiResponses)

Example 14 with Ack

use of org.wso2.ei.dashboard.core.rest.model.Ack in project product-mi-tooling by wso2.

the class ProxyServiceDelegate method updateArtifact.

@Override
public Ack updateArtifact(String groupId, ArtifactUpdateRequest request) throws ManagementApiException {
    logger.debug("Updating proxy service " + request.getArtifactName() + " in node " + request.getNodeId() + " in group " + groupId);
    Ack ack = new Ack(Constants.FAIL_STATUS);
    boolean isSuccess = updateProxyService(groupId, request);
    if (isSuccess) {
        ack.setStatus(Constants.SUCCESS_STATUS);
    }
    return ack;
}
Also used : Ack(org.wso2.ei.dashboard.core.rest.model.Ack)

Example 15 with Ack

use of org.wso2.ei.dashboard.core.rest.model.Ack in project product-mi-tooling by wso2.

the class SequencesDelegate method updateArtifact.

@Override
public Ack updateArtifact(String groupId, ArtifactUpdateRequest request) throws ManagementApiException {
    logger.debug("Updating sequence " + request.getArtifactName() + " in node " + request.getNodeId() + " in group " + groupId);
    Ack ack = new Ack(Constants.FAIL_STATUS);
    boolean isSuccess = updateSequence(groupId, request);
    if (isSuccess) {
        ack.setStatus(Constants.SUCCESS_STATUS);
    }
    return ack;
}
Also used : Ack(org.wso2.ei.dashboard.core.rest.model.Ack)

Aggregations

Ack (org.wso2.ei.dashboard.core.rest.model.Ack)17 JsonObject (com.google.gson.JsonObject)5 Operation (io.swagger.v3.oas.annotations.Operation)5 ApiResponses (io.swagger.v3.oas.annotations.responses.ApiResponses)5 ApiResponse (io.swagger.v3.oas.annotations.responses.ApiResponse)4 Response (javax.ws.rs.core.Response)4 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)4 NodeList (org.wso2.ei.dashboard.core.rest.model.NodeList)4 LogConfigDelegate (org.wso2.ei.dashboard.micro.integrator.delegates.LogConfigDelegate)3 NodeListInner (org.wso2.ei.dashboard.core.rest.model.NodeListInner)2 UsersDelegate (org.wso2.ei.dashboard.micro.integrator.delegates.UsersDelegate)2 HL7Exception (ca.uhn.hl7v2.HL7Exception)1 Message (ca.uhn.hl7v2.model.Message)1 DefaultHttpResponse (io.netty.handler.codec.http.DefaultHttpResponse)1 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 AxisFault (org.apache.axis2.AxisFault)1 ConfigurationContext (org.apache.axis2.context.ConfigurationContext)1 MessageContext (org.apache.axis2.context.MessageContext)1 Parameter (org.apache.axis2.description.Parameter)1