DronaBlog

Showing posts with label Microservices. Show all posts
Showing posts with label Microservices. Show all posts

Wednesday, April 5, 2023

What is Bug, Error and Issue?

In the world of software development, terms like "bug," "error," and "issue" are often used interchangeably. However, there are subtle differences between these terms that can be important to understand, especially when communicating with other developers or stakeholders. In this article, we'll explore the differences between these three terms and how they relate to software development.






A. Bug:

A bug is a defect or flaw in the software that causes it to behave in an unintended way. This can result from a coding mistake or a problem with the software's design. Bugs can range in severity from minor glitches to major issues that prevent the software from working at all. They are typically discovered during testing or after the software has been released and are often fixed by the development team through a software update or patch.


B. Error:

An error is a mistake made by a programmer during the coding process. Errors can be syntax errors, where the code does not conform to the language's rules, or logic errors, where the code does not perform the intended function. Errors can occur during development or after the software has been released and can lead to bugs or other issues. Programmers can use debugging tools to identify and fix errors in their code.


C. Issue:

An issue is a problem or challenge that arises during the software development process. Issues can include bugs, errors, or other obstacles that affect the software's functionality, performance, or usability. Issues can also arise from external factors, such as hardware or network problems. Tracking issues is an important part of software development, as it allows developers to identify areas for improvement and ensure that the software meets the needs of its users.






In summary, bugs, errors, and issues are all related to software development, but they represent different aspects of the process. Bugs are defects in the software that cause unintended behavior, errors are mistakes made during the coding process, and issues are problems or challenges that arise during development. Understanding these differences can help developers communicate more effectively and improve the quality of their software. 


Learn more



Friday, March 17, 2023

What are top 7 Microservices Patterns?

Are you planning to implement Microservices in your project? Are you looking for details about what are the different Microservices patterns? If so, then you reached the place. In this  article, we will understand various Microservices patterns in detail. Let's start






Introduction

Microservices architecture is a popular software development approach that emphasizes the creation of small, independent services that can work together to deliver a larger application or system. This approach has become popular due to the flexibility, scalability, and maintainability it offers. However, designing and implementing a microservices-based system can be challenging. To help address these challenges, developers have come up with various patterns for designing and implementing microservices. In this article, we'll discuss some of the most common microservices patterns.


1. Service Registry Pattern

The service registry pattern involves using a centralized registry to keep track of all available services in a system. Each service registers itself with the registry and provides metadata about its location and capabilities. This enables other services to discover and communicate with each other without having to hardcode the location of each service.







2. API Gateway Pattern

The API gateway pattern involves using a single entry point for all client requests to a system. The gateway then routes requests to the appropriate microservice based on the request type. This pattern simplifies client access to the system and provides a layer of abstraction between clients and microservices.


3. Circuit Breaker Pattern

The circuit breaker pattern involves using a component that monitors requests to a microservice and breaks the circuit if the microservice fails to respond. This prevents cascading failures and improves system resilience.


4. Event Sourcing Pattern

The event sourcing pattern involves storing all changes to a system's state as a sequence of events. This enables the system to be reconstructed at any point in time and provides a reliable audit trail of all changes to the system.


5. CQRS Pattern

The CQRS (Command Query Responsibility Segregation) pattern involves separating read and write operations in a system. This enables the system to optimize for each type of operation and improves system scalability and performance.



5. Saga Pattern

The saga pattern involves using a sequence of transactions to ensure consistency in a distributed system. Each transaction is responsible for a specific task and can be rolled back if an error occurs. This pattern is useful for long-running transactions that involve multiple microservices.


6. Bulkhead Pattern

The bulkhead pattern involves isolating microservices in separate threads or processes to prevent failures in one microservice from affecting others. This pattern improves system resilience and availability.






In conclusion, microservices patterns are essential for designing and implementing scalable, maintainable, and resilient microservices-based systems. The patterns discussed in this article are just a few of the many patterns available, but they are some of the most common and widely used. By understanding and using these patterns, developers can create microservices-based systems that are easier to develop, deploy, and maintain.


Learn more about Microservices here



Wednesday, July 4, 2018

How to write set method for classes generated by wsdl2java


If we generate classes using the wsdl2java tool then some of the classes do not generate the setter method since the get method will act as the setter method. Few of the calling applications need the setter method.


Below is an example of how to write the setter method for the classes generated by the wsdl2java tool.

e.g. Let's consider the example of the AddressList calls which contains the object of the Address class.

public class Address {
    protected String addressLine1;
    protected String addressLine2;
    protected String cityName;
    protected String stateName;
    protected String countryCode;
    protected String countryName;
    protected String zipcode;

    /**
     * Gets the value of the addressLine1 property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getAddressLine1() {
        return addressLine1;
    }

    /**
     * Sets the value of the addressLine1 property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setAddressLine1(String value) {
        this.addressLine1 = value;
    }

    /**
     * Gets the value of the addressLine2 property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getAddressLine2() {
        return addressLine2;
    }

    /**
     * Sets the value of the addressLine2 property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setAddressLine2(String value) {
        this.addressLine2 = value;
    }

    /**
     * Gets the value of the cityName property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getCityName() {
        return cityName;
    }

    /**
     * Sets the value of the cityName property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setCityName(String value) {
        this.cityName = value;
    }

    /**
     * Gets the value of the stateName property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getStateName() {
        return stateName;
    }

    /**
     * Sets the value of the stateName property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setStateName(String value) {
        this.stateName = value;
    }

    /**
     * Gets the value of the countryCode property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getCountryCode() {
        return countryCode;
    }

    /**
     * Sets the value of the countryCode property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setCountryCode(String value) {
        this.countryCode = value;
    }

    /**
     * Gets the value of the countryName property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getCountryName() {
        return countryName;
    }

    /**
     * Sets the value of the countryName property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setCountryName(String value) {
        this.countryName = value;
    }

    /**
     * Gets the value of the zipcode property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getZipcode() {
        return zipcode;
    }

    /**
     * Sets the value of the zipcode property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setZipcode(String value) {
        this.zipcode = value;
    }
  }

Below is example for writing setter method -


public class AddressList {
    protected List<Address> address;

    /**
     * Gets the value of the address property.
     * 
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the address property.
     * 
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getAddress().add(newItem);
     * </pre>
     * 
     * 
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link Address }
     * 
     * 
     */
    public List<Address> getAddress() {
        if (address == null) {
            address = new ArrayList<Address>();
        }
        return this.address;
    }
    
    public void setAddress(Address oaddress) {
     if (null != address)
     address.add(oaddress);
     else {
     List<Address> listAddress = new ArrayList<Address>();
     listAddress.add(oaddress);
     this.address = listAddress;
     }
    }





Tuesday, July 3, 2018

How to handle NoSuchMethodException exception

Scenario : 
The exception - NoSuchMethodException occurs if the setter or the getter method does not present in classes created during the WSDL skeleton or the client generation.

public class ElectronicAddressRequest {
    protected List<ElectronicAddressSO> electronicAddress;

    public List<ElectronicAddressSO> getElectronicAddress() {
        if (electronicAddress == null) {
            electronicAddress = new ArrayList<ElectronicAddressSO>();
        }
        return this.electronicAddress;
    }


Here is what the ElectronicAddressSO class looks like below :

public class ElectronicAddressSO {

    protected String electronicAddress;
    protected String electronicAddressType;

    public String getElectronicAddress() {
        return electronicAddress;
    }

     public void setElectronicAddress(String value) {
        this.electronicAddress = value;
    }

     public String getElectronicAddressType() {
        return electronicAddressType;
    }

     public void setElectronicAddressType(String value) {
        this.electronicAddressType = value;
    }

}

In the above code, the setter method is not created for the ElectronicAddressRequest if you use the wsdl2j tool to create the skeleton.

Error  :

When you try to run the application you will get the error below.

weblogic.wsee.jaxws.framework.policy.advertisementimpl.AdvertisementHelperImpl registerExtension
WARNING: Registering oracle.j2ee.ws.wsdl.extensions.addressing.AddressingExtensionRegistry extension failed; java.lang.NoSuchMethodException: oracle.j2ee.ws.wsdl.extensions.addressing.AddressingExtensionRegistry.registerSerializersAndTypes(com.ibm.wsdl.extensions.PopulatedExtensionRegistry)
Mar 11, 2015 12:22:12 PM weblogic.wsee.jaxws.spi.WLSServiceDelegate addWsdlDefinitionFeature
SEVERE: Failed to create WsdlDefinitionFeature for wsdl location: http://rmv-eap-spr-d11.ddc.dot.state.ma.us:57453/MARMV_MainFrame_Provider/LicenseUpdateService?wsdl, error: com.sun.xml.ws.wsdl.parser.InaccessibleWSDLException, message: 2 counts of InaccessibleWSDLException.


Solution :
In order to handle this error, add the method below in the ElectronicAddressRequest class :


public void setElectronicAddress(ElectronicAddressSO oElectronicAddressSO) {
        if (null != electronicAddress) {
            electronicAddress.add(oElectronicAddressSO);
        } else {
            List<ElectronicAddressSO> listContactInformation = new ArrayList<ElectronicAddressSO>();
            listContactInformation.add(oElectronicAddressSO);
            this.electronicAddress = listContactInformation;
        }
    }

Cloudflare: An In-depth Look at Its Advantages and Disadvantages

 Cloudflare is a prominent American web infrastructure and website security company that offers a range of services to enhance website perfo...